Merge branch 'nightly'
This commit is contained in:
@@ -106,7 +106,7 @@ function toggleAccountGUICommand(command, params, client) {
|
||||
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
if(getPlayerData().accountData.databaseId != 0) {
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerLoginGUI(client);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI`);
|
||||
} else {
|
||||
@@ -115,7 +115,7 @@ function toggleAccountGUICommand(command, params, client) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled)`);
|
||||
}
|
||||
} else {
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerRegistrationGUI(client);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
||||
} else {
|
||||
@@ -566,13 +566,31 @@ function loginSuccess(client) {
|
||||
client.administrator = true;
|
||||
}
|
||||
|
||||
if(doesServerHaveTesterOnlyEnabled()) {
|
||||
if(!hasBitFlag(getPlayerData(client).accountData.flags.moderation, getModerationFlagValue("IsTester"))) {
|
||||
setTimeout(function() {
|
||||
client.disconnect();
|
||||
}, 3500);
|
||||
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
|
||||
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
|
||||
return false;
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
|
||||
messagePlayerError(client, getLocaleString(client, "NotATester"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(getPlayerData(client).subAccounts.length == 0) {
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerPromptGUI(client, `You have no characters. Would you like to make one?`, "No characters");
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerPromptGUI(client, getLocaleString(client, "NoCharactersGUIMessage"), getLocaleString(client, "NoCharactersGUIWindowTitle"));
|
||||
getPlayerData(client).promptType = VRR_PROMPT_CREATEFIRSTCHAR;
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters prompt GUI`);
|
||||
} else {
|
||||
messagePlayerAlert(client, `You have no characters. Use /newchar to make one.`);
|
||||
messagePlayerAlert(client, getLocaleString(client, "NoCharactersChatMessage", `{ALTCOLOUR}/newchar{MAINCOLOUR}`));
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters message (GUI disabled)`);
|
||||
}
|
||||
} else {
|
||||
@@ -760,7 +778,7 @@ function checkLogin(client, password) {
|
||||
|
||||
if(isPlayerLoggedIn(client)) {
|
||||
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is already logged in`);
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerLoginSuccessGUI(client);
|
||||
} else {
|
||||
messagePlayerError(client, "You are already logged in!");
|
||||
@@ -771,7 +789,7 @@ function checkLogin(client, password) {
|
||||
|
||||
if(!isPlayerRegistered(client)) {
|
||||
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is not registered`);
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerRegistrationGUI(client);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
||||
} else {
|
||||
@@ -783,7 +801,7 @@ function checkLogin(client, password) {
|
||||
|
||||
if(areParamsEmpty(password)) {
|
||||
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (empty password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerLoginFailedGUI(client, `Invalid password! ${getPlayerData(client).loginAttemptsRemaining} tries remaining.`);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||
} else {
|
||||
@@ -799,7 +817,7 @@ function checkLogin(client, password) {
|
||||
|
||||
if(!isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(getPlayerName(client), password))) {
|
||||
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (wrong password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerLoginFailedGUI(client, `Invalid password! ${getPlayerData(client).loginAttemptsRemaining} tries remaining.`);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||
} else {
|
||||
@@ -819,7 +837,7 @@ function checkLogin(client, password) {
|
||||
// return true;
|
||||
//}
|
||||
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerLoginSuccessGUI(client);
|
||||
}
|
||||
|
||||
@@ -836,7 +854,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account]: Checking registration for ${getPlayerName(client)}`);
|
||||
|
||||
if(isPlayerRegistered(client)) {
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerLoginGUI(client);
|
||||
} else {
|
||||
messagePlayerError(client, getLocaleString(client, "AlreadyRegistered"));
|
||||
@@ -846,7 +864,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
||||
}
|
||||
|
||||
if(isPlayerLoggedIn(client)) {
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerLoginSuccessGUI(client);
|
||||
} else {
|
||||
messagePlayerError(client, getLocaleString(client, "AlreadyLoggedIn"));
|
||||
@@ -856,7 +874,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
||||
}
|
||||
|
||||
if(areParamsEmpty(password)) {
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPassword"));
|
||||
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password is blank)`);
|
||||
} else {
|
||||
@@ -866,7 +884,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(areParamsEmpty(confirmPassword)) {
|
||||
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPasswordConfirm"));
|
||||
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password confirm is blank)`);
|
||||
@@ -874,7 +892,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
||||
}
|
||||
}
|
||||
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(areParamsEmpty(emailAddress)) {
|
||||
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoEmail"));
|
||||
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (email address is blank)`);
|
||||
@@ -882,7 +900,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
||||
}
|
||||
}
|
||||
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(password != confirmPassword) {
|
||||
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedPasswordMismatch"));
|
||||
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password and confirm don't match)`);
|
||||
@@ -891,7 +909,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
||||
}
|
||||
|
||||
if(!doesPasswordMeetRequirements(password)) {
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
// Work on this later. Function should return true by default anyway for now.
|
||||
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPasswordWeak"));
|
||||
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password doesn't meet requirements)`);
|
||||
@@ -901,7 +919,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
||||
return false
|
||||
}
|
||||
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(!isValidEmailAddress(emailAddress)) {
|
||||
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedInvalidEmail"));
|
||||
return false
|
||||
@@ -910,7 +928,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
||||
|
||||
let accountData = createAccount(getPlayerName(client), password, emailAddress);
|
||||
if(!accountData) {
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedCreateError"));
|
||||
} else {
|
||||
messagePlayerAlert(client, getLocaleString(client, "RegistrationFailedCreateError"));
|
||||
@@ -926,22 +944,36 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
||||
messagePlayerSuccess(client, getLocaleString(client, "RegistrationSuccess"));
|
||||
if(checkForSMTPModule() && getEmailConfig().enabled) {
|
||||
messagePlayerAlert(client, getLocaleString(client, "RegistrationEmailVerifyReminder"));
|
||||
let emailVerificationCode = generateEmailVerificationCode();
|
||||
setAccountEmailVerificationCode(getPlayerData(client).accountData, emailVerificationCode);
|
||||
sendEmailVerificationEmail(client, emailVerificationCode);
|
||||
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} was sent a registration email verification code`);
|
||||
}
|
||||
messagePlayerAlert(client, getLocaleString(client, "RegistrationCreateCharReminder"));
|
||||
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerRegistrationSuccessGUI(client);
|
||||
showPlayerPromptGUI(client, getLocaleString(client, "NoCharactersMessage"), getLocaleString(client, "NoCharactersWindowTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
|
||||
getPlayerData(client).promptType = VRR_PROMPT_CREATEFIRSTCHAR;
|
||||
if(doesServerHaveTesterOnlyEnabled() && !isPlayerATester(client)) {
|
||||
setTimeout(function() {
|
||||
client.disconnect();
|
||||
}, 5000);
|
||||
|
||||
if(checkForSMTPModule() && getEmailConfig().enabled) {
|
||||
let emailVerificationCode = generateEmailVerificationCode();
|
||||
setAccountEmailVerificationCode(getPlayerData(client).accountData, emailVerificationCode);
|
||||
sendEmailVerificationEmail(client, emailVerificationCode);
|
||||
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} was sent a registration email verification code`);
|
||||
}
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
|
||||
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
|
||||
return false;
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
|
||||
messagePlayerError(client, getLocaleString(client, "NotATester"));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
messagePlayerAlert(client, getLocaleString(client, "NoCharactersChatMessage"));
|
||||
messagePlayerAlert(client, getLocaleString(client, "RegistrationCreateCharReminder"));
|
||||
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerRegistrationSuccessGUI(client);
|
||||
showPlayerPromptGUI(client, getLocaleString(client, "NoCharactersMessage"), getLocaleString(client, "NoCharactersWindowTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
|
||||
getPlayerData(client).promptType = VRR_PROMPT_CREATEFIRSTCHAR;
|
||||
} else {
|
||||
messagePlayerAlert(client, getLocaleString(client, "NoCharactersChatMessage"), `{ALTCOLOUR}/newchar{MAINCOLOUR}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1084,6 +1116,12 @@ function initClient(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(client.getData("vrr.isInitialized") != null || client.getData("vrr.isInitialized") == true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
client.setData("vrr.isInitialized", true, false);
|
||||
|
||||
sendPlayerGUIColours(client);
|
||||
sendPlayerGUIInit(client);
|
||||
updatePlayerSnowState(client);
|
||||
@@ -1109,7 +1147,7 @@ function initClient(client) {
|
||||
messagePlayerAlert(client, getLocaleString(client, "AutoLoggedInIP"));
|
||||
loginSuccess(client);
|
||||
} else {
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI.`);
|
||||
showPlayerLoginGUI(client);
|
||||
} else {
|
||||
@@ -1119,7 +1157,7 @@ function initClient(client) {
|
||||
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
|
||||
}
|
||||
} else {
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI.`);
|
||||
showPlayerRegistrationGUI(client);
|
||||
} else {
|
||||
@@ -1453,4 +1491,10 @@ function checkPlayerTwoFactorAuthentication(client, authCode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerATester(client) {
|
||||
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -70,7 +70,7 @@ function stopPlayerAnimationCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function showAnimationListCommand(command, params, client) {
|
||||
let animList = getGameData().animations[getServerGame()].map(function(x) { return x[0]; });
|
||||
let animList = getGameConfig().animations[getServerGame()].map(function(x) { return x[0]; });
|
||||
|
||||
let chunkedList = splitArrayIntoChunks(animList, 10);
|
||||
|
||||
@@ -88,7 +88,7 @@ function showAnimationListCommand(command, params, client) {
|
||||
* @return {Array} The animation's data (array)
|
||||
*/
|
||||
function getAnimationData(animationSlot, gameId = getServerGame()) {
|
||||
return getGameData().animations[gameId][animationSlot];
|
||||
return getGameConfig().animations[gameId][animationSlot];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -145,13 +145,13 @@ function makePlayerStopAnimation(client) {
|
||||
|
||||
function getAnimationFromParams(params) {
|
||||
if(isNaN(params)) {
|
||||
for(let i in getGameData().animations[getServerGame()]) {
|
||||
if(toLowerCase(getGameData().animations[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
|
||||
for(let i in getGameConfig().animations[getServerGame()]) {
|
||||
if(toLowerCase(getGameConfig().animations[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(typeof getGameData().animations[getServerGame()][params] != "undefined") {
|
||||
if(typeof getGameConfig().animations[getServerGame()][params] != "undefined") {
|
||||
return toInteger(params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,8 @@ let serverBitFlagKeys = {
|
||||
"TwoFactorAuthVerified",
|
||||
"NonRoleplayCharacterName",
|
||||
"CanHearEverything",
|
||||
"DontSyncClientElements"
|
||||
"DontSyncClientElements",
|
||||
"IsTester"
|
||||
],
|
||||
factionFlagKeys: [
|
||||
"None",
|
||||
@@ -409,7 +410,7 @@ function getModerationFlagValue(flagName) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getServerSettingFlagValue(flagName) {
|
||||
function getServerSettingsFlagValue(flagName) {
|
||||
if(flagName == "All") {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1336,6 +1336,10 @@ function createAllBusinessBlips() {
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessEntrancePickup(businessId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getServerConfig().createBusinessPickups) {
|
||||
return false;
|
||||
}
|
||||
@@ -1348,18 +1352,24 @@ function createBusinessEntrancePickup(businessId) {
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
|
||||
|
||||
getBusinessData(businessId).entrancePickup = createGamePickup(pickupModelId, getBusinessData(businessId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].business);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false);
|
||||
setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension);
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
addToWorld(getBusinessData(businessId).entrancePickup);
|
||||
|
||||
if(areServerElementsSupported()) {
|
||||
getBusinessData(businessId).entrancePickup = createGamePickup(pickupModelId, getBusinessData(businessId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].business);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false);
|
||||
setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension);
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
addToWorld(getBusinessData(businessId).entrancePickup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessEntranceBlip(businessId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getServerConfig().createBusinessBlips) {
|
||||
return false;
|
||||
}
|
||||
@@ -1372,11 +1382,13 @@ function createBusinessEntranceBlip(businessId) {
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
|
||||
|
||||
getBusinessData(businessId).entranceBlip = createGameBlip(getBusinessData(businessId).entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
|
||||
setElementDimension(getBusinessData(businessId).entranceBlip, getBusinessData(businessId).entranceDimension);
|
||||
addToWorld(getBusinessData(businessId).entranceBlip);
|
||||
|
||||
if(areServerElementsSupported()) {
|
||||
getBusinessData(businessId).entranceBlip = createGameBlip(getBusinessData(businessId).entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
|
||||
setElementDimension(getBusinessData(businessId).entranceBlip, getBusinessData(businessId).entranceDimension);
|
||||
addToWorld(getBusinessData(businessId).entranceBlip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1396,12 +1408,14 @@ function createBusinessExitPickup(businessId) {
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
|
||||
|
||||
getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
|
||||
setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).exitPickup, false);
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
addToWorld(getBusinessData(businessId).exitPickup);
|
||||
|
||||
if(areServerElementsSupported()) {
|
||||
getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
|
||||
setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).exitPickup, false);
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
addToWorld(getBusinessData(businessId).exitPickup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1421,15 +1435,17 @@ function createBusinessExitBlip(businessId) {
|
||||
blipModelId = getBusinessData(businessId).exitBlipModel;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
|
||||
if(areServerElementsSupported()) {
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
|
||||
|
||||
getBusinessData(businessId).exitBlip = createGameBlip(getBusinessData(businessId).exitPosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||
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);
|
||||
addToWorld(getBusinessData(businessId).exitBlip);
|
||||
getBusinessData(businessId).exitBlip = createGameBlip(getBusinessData(businessId).exitPosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||
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);
|
||||
addToWorld(getBusinessData(businessId).exitBlip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1907,6 +1923,10 @@ function getBusinessIdFromDatabaseId(databaseId) {
|
||||
// ===========================================================================
|
||||
|
||||
function updateBusinessPickupLabelData(businessId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@@ -22,8 +22,6 @@ function initClassScript() {
|
||||
class ServerData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.name = "";
|
||||
this.password = "";
|
||||
this.needsSaved = false;
|
||||
|
||||
this.newCharacter = {
|
||||
@@ -59,6 +57,8 @@ class ServerData {
|
||||
this.guiTextColourSecondary = [0, 0, 0];
|
||||
this.showLogo = true;
|
||||
this.inflationMultiplier = 1;
|
||||
this.testerOnly = false;
|
||||
this.settings = 0;
|
||||
|
||||
this.antiCheat = {
|
||||
enabled: false,
|
||||
@@ -104,52 +104,47 @@ class ServerData {
|
||||
bank: dbAssoc["svr_newchar_bank"],
|
||||
skin: dbAssoc["svr_newchar_skin"],
|
||||
},
|
||||
this.settings = toInteger(dbAssoc["svr_settings"]);
|
||||
|
||||
this.connectCameraPosition = toVector3(dbAssoc["svr_connectcam_pos_x"], dbAssoc["svr_connectcam_pos_y"], dbAssoc["svr_connectcam_pos_z"]);
|
||||
this.connectCameraLookAt = toVector3(dbAssoc["svr_connectcam_lookat_x"], dbAssoc["svr_connectcam_lookat_y"], dbAssoc["svr_connectcam_lookat_z"]);
|
||||
|
||||
//this.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"]);
|
||||
this.minuteDuration = toInteger(dbAssoc["svr_time_min_duration"]);
|
||||
this.weather = toInteger(dbAssoc["svr_start_weather"]);
|
||||
this.fallingSnow = intToBool(dbAssoc["svr_start_snow_falling"]);
|
||||
this.groundSnow = intToBool(dbAssoc["svr_start_snow_ground"]);
|
||||
this.useGUI = intToBool(dbAssoc["svr_gui"]);
|
||||
this.fallingSnow = hasBitFlag(this.settings, getServerSettingsFlagValue("FallingSnow"));
|
||||
this.groundSnow = hasBitFlag(this.settings, getServerSettingsFlagValue("GroundSnow"));
|
||||
this.useGUI = hasBitFlag(this.settings, getServerSettingsFlagValue("GUI"));
|
||||
this.guiColourPrimary = [toInteger(dbAssoc["svr_gui_col1_r"]), toInteger(dbAssoc["svr_gui_col1_g"]), toInteger(dbAssoc["svr_gui_col1_b"])];
|
||||
this.guiColourSecondary = [toInteger(dbAssoc["svr_gui_col2_r"]), toInteger(dbAssoc["svr_gui_col2_g"]), toInteger(dbAssoc["svr_gui_col2_b"])];
|
||||
this.guiTextColourPrimary = [toInteger(dbAssoc["svr_gui_textcol1_r"]), toInteger(dbAssoc["svr_gui_textcol1_g"]), toInteger(dbAssoc["svr_gui_textcol1_b"])];
|
||||
//this.guiTextColourSecondary = [toInteger(dbAssoc["svr_gui_textcol2_r"]), toInteger(dbAssoc["svr_gui_textcol2_g"]), toInteger(dbAssoc["svr_gui_textcol2_b"])];
|
||||
this.showLogo = intToBool(dbAssoc["svr_logo"]);
|
||||
this.showLogo = hasBitFlag(this.settings, getServerSettingsFlagValue("Logo"));
|
||||
this.inflationMultiplier = toFloat(dbAssoc["svr_inflation_multiplier"]);
|
||||
this.testerOnly = hasBitFlag(this.settings, getServerSettingsFlagValue("Testing"));
|
||||
|
||||
this.antiCheat = {
|
||||
enabled: intToBool(dbAssoc["svr_ac_enabled"]),
|
||||
checkGameScripts: intToBool(dbAssoc["svr_ac_check_scripts"]),
|
||||
gameScriptBlackListEnabled: intToBool(dbAssoc["svr_ac_script_bl"]),
|
||||
gameScriptWhiteListEnabled: intToBool(dbAssoc["svr_ac_script_wl"]),
|
||||
enabled: hasBitFlag(this.settings, getServerSettingsFlagValue("Anticheat")),
|
||||
checkGameScripts: hasBitFlag(this.settings, getServerSettingsFlagValue("CheckGameScripts")),
|
||||
gameScriptBlackListEnabled: hasBitFlag(this.settings, getServerSettingsFlagValue("GameScriptBlackList")),
|
||||
gameScriptWhiteListEnabled: hasBitFlag(this.settings, getServerSettingsFlagValue("GameScriptWhiteList")),
|
||||
gameScriptWhiteList: [],
|
||||
gameScriptBlackList: [],
|
||||
};
|
||||
|
||||
this.discordBotToken = intToBool(dbAssoc["svr_discord_bot_token"]);
|
||||
this.discordEnabled = intToBool(dbAssoc["svr_discord_bot_enabled"]);
|
||||
this.discordEnabled = hasBitFlag(this.settings, getServerSettingsFlagValue("DiscordBot"));
|
||||
|
||||
this.createJobPickups = intToBool(dbAssoc["svr_job_pickups"]);
|
||||
this.createBusinessPickups = intToBool(dbAssoc["svr_biz_pickups"]);
|
||||
this.createHousePickups = intToBool(dbAssoc["svr_house_pickups"]);
|
||||
this.createJobBlips = intToBool(dbAssoc["svr_job_blips"]);
|
||||
this.createBusinessBlips = intToBool(dbAssoc["svr_biz_blips"]);
|
||||
this.createHouseBlips = intToBool(dbAssoc["svr_house_blips"]);
|
||||
this.createJobPickups = hasBitFlag(this.settings, getServerSettingsFlagValue("JobPickups"));
|
||||
this.createBusinessPickups = hasBitFlag(this.settings, getServerSettingsFlagValue("BusinessPickups"));
|
||||
this.createHousePickups = hasBitFlag(this.settings, getServerSettingsFlagValue("HousePickups"));
|
||||
this.createJobBlips = hasBitFlag(this.settings, getServerSettingsFlagValue("JobBlips"));
|
||||
this.createBusinessBlips = hasBitFlag(this.settings, getServerSettingsFlagValue("BusinessBlips"));
|
||||
this.createHouseBlips = hasBitFlag(this.settings, getServerSettingsFlagValue("HouseBlips"));
|
||||
|
||||
this.introMusicURL = dbAssoc["svr_intro_music"];
|
||||
this.useRealTime = intToBool(dbAssoc["svr_time_realtime_enabled"]);
|
||||
this.useRealTime = hasBitFlag(this.settings, getServerSettingsFlagValue("RealTime"));
|
||||
this.realTimeZone = dbAssoc["svr_time_realtime_timezone"];
|
||||
|
||||
this.discordConfig = {
|
||||
|
||||
@@ -410,14 +410,14 @@ function showPlayerPromptGUI(client, promptMessage, promptTitle, yesButtonText,
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerInfoGUI(client, infoMessage, infoTitle) {
|
||||
function showPlayerInfoGUI(client, infoMessage, infoTitle, buttonText = "OK") {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`);
|
||||
sendNetworkEventToPlayer("vrr.showInfo", client, infoMessage, infoTitle, buttonText);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerErrorGUI(client, errorMessage, errorTitle) {
|
||||
function showPlayerErrorGUI(client, errorMessage, errorTitle, buttonText = "OK") {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`);
|
||||
sendNetworkEventToPlayer("vrr.showInfo", client, errorMessage, errorTitle, buttonText);
|
||||
}
|
||||
@@ -522,13 +522,6 @@ function sendPlayerFrozenState(client, state) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerWeapon(client, weaponId, ammo, active = true) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
||||
sendNetworkEventToPlayer("vrr.giveWeapon", client, weaponId, ammo, active);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function clearPlayerWeapons(client) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
|
||||
sendNetworkEventToPlayer("vrr.clearWeapons", client);
|
||||
@@ -1141,4 +1134,16 @@ function setPlayerInfiniteRun(client, state) {
|
||||
sendNetworkEventToPlayer("vrr.infiniteRun", client, state);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
function sendBusinessEntranceToPlayer(client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
|
||||
sendNetworkEventToPlayer("vrr.business", client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
function sendHouseEntranceToPlayer(client, houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
|
||||
sendNetworkEventToPlayer("vrr.house", client, houseId, entrancePosition, blipModel, pickupModel, hasInterior);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
@@ -68,12 +68,12 @@ function loadCommands() {
|
||||
commandData("stopanim", stopPlayerAnimationCommand, "", getStaffFlagValue("None"), true, true, "Stops your current animation"),
|
||||
],
|
||||
antiCheat: [
|
||||
commandData("addacscriptwl", addAntiCheatWhiteListedScriptCommand, "<script name>", getStaffFlagValue("Developer"), true, true),
|
||||
commandData("delacscriptwl", removeAntiCheatWhiteListedScriptCommand, "<script name>", getStaffFlagValue("Developer"), true, true),
|
||||
commandData("addacscriptbl", addAntiCheatBlackListedScriptCommand, "<script name>", getStaffFlagValue("Developer"), true, true),
|
||||
commandData("delacscriptbl", removeAntiCheatBlackListedScriptCommand, "<script name>", getStaffFlagValue("Developer"), true, true),
|
||||
commandData("setacscriptbl", toggleAntiCheatScriptBlackListCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
|
||||
commandData("setacscriptwl", toggleAntiCheatScriptWhiteListCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
|
||||
commandData("addacscriptwl", addAntiCheatWhiteListedScriptCommand, "<script name>", getStaffFlagValue("ManageAntiCheat"), true, true),
|
||||
commandData("delacscriptwl", removeAntiCheatWhiteListedScriptCommand, "<script name>", getStaffFlagValue("ManageAntiCheat"), true, true),
|
||||
commandData("addacscriptbl", addAntiCheatBlackListedScriptCommand, "<script name>", getStaffFlagValue("ManageAntiCheat"), true, true),
|
||||
commandData("delacscriptbl", removeAntiCheatBlackListedScriptCommand, "<script name>", getStaffFlagValue("ManageAntiCheat"), true, true),
|
||||
commandData("setacscriptbl", toggleAntiCheatScriptBlackListCommand, "<0/1 state>", getStaffFlagValue("ManageAntiCheat"), true, true),
|
||||
commandData("setacscriptwl", toggleAntiCheatScriptWhiteListCommand, "<0/1 state>", getStaffFlagValue("ManageAntiCheat"), true, true),
|
||||
//commandData("setac", toggleGlobalAntiCheatCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
|
||||
//commandData("ac", getGlobalAntiCheatStatusCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
|
||||
],
|
||||
@@ -183,10 +183,10 @@ function loadCommands() {
|
||||
commandData("cmddisable", disableCommand, "<command>", getStaffFlagValue("Developer"), true, true, "Disables a specific command"),
|
||||
],
|
||||
config: [
|
||||
commandData("settime", setTimeCommand, "<hour> [minute]", getStaffFlagValue("ManageServer"), true, true, "Sets the time. Hours are required, minute is optional and will default to 0"),
|
||||
commandData("setminuteduration", setMinuteDurationCommand, "<time in ms>", getStaffFlagValue("ManageServer"), true, true, "Sets how long a minute lasts in milliseconds. 60000 is real time."),
|
||||
commandData("setweather", setWeatherCommand, "<weather id/name>", getStaffFlagValue("ManageServer"), true, true, "Change the weather to specified type."),
|
||||
commandData("setsnow", setSnowingCommand, "<falling snow> <ground snow>", getStaffFlagValue("ManageServer"), true, true, "Toggles winter/snow"),
|
||||
commandData("settime", setTimeCommand, "<hour> [minute]", getStaffFlagValue("ManageWorld"), true, true, "Sets the time. Hours are required, minute is optional and will default to 0"),
|
||||
commandData("setminuteduration", setMinuteDurationCommand, "<time in ms>", getStaffFlagValue("ManageWorld"), true, true, "Sets how long a minute lasts in milliseconds. 60000 is real time."),
|
||||
commandData("setweather", setWeatherCommand, "<weather id/name>", getStaffFlagValue("ManageWorld"), true, true, "Change the weather to specified type."),
|
||||
commandData("setsnow", setSnowingCommand, "<falling snow> <ground snow>", getStaffFlagValue("ManageWorld"), true, true, "Toggles winter/snow"),
|
||||
commandData("setlogo", toggleServerLogoCommand, "<0/1 state>", getStaffFlagValue("ManageServer"), true, true, "Toggles the corner server logo display on/off"),
|
||||
commandData("setgui", toggleServerGUICommand, "<0/1 state>", getStaffFlagValue("ManageServer"), true, true, "Toggles server GUI on/off"),
|
||||
commandData("setguicolours", setServerGUIColoursCommand, "<red> <green> <blue>", getStaffFlagValue("ManageServer"), true, true),
|
||||
@@ -229,7 +229,7 @@ function loadCommands() {
|
||||
commandData("forceresetpass", forceAccountPasswordResetCommand, "<account name>", getStaffFlagValue("Developer"), true, true),
|
||||
commandData("fixblips", fixAllServerBlipsCommand, "", getStaffFlagValue("Developer"), true, true),
|
||||
commandData("fixpickups", fixAllServerPickupsCommand, "", getStaffFlagValue("Developer"), true, true),
|
||||
commandData("resetambience", resetAllServerAmbienceElementsCommand, "", getStaffFlagValue("Developer"), true, true),
|
||||
commandData("resetambience", resetAllServerAmbienceElementsCommand, "", getStaffFlagValue("ManageWorld"), true, true),
|
||||
],
|
||||
discord: [],
|
||||
economy: [
|
||||
@@ -335,7 +335,7 @@ function loadCommands() {
|
||||
commandData("drag", policeDragCommand, "", getStaffFlagValue("None"), true, false),
|
||||
commandData("search", policeSearchCommand, "", getStaffFlagValue("None"), true, false),
|
||||
|
||||
// Bus/Garbage
|
||||
// Routes
|
||||
commandData("startroute", jobStartRouteCommand, "", getStaffFlagValue("None"), true, false),
|
||||
commandData("stoproute", jobStopRouteCommand, "", getStaffFlagValue("None"), true, false),
|
||||
|
||||
@@ -381,6 +381,9 @@ function loadCommands() {
|
||||
],
|
||||
locale: [
|
||||
commandData("lang", setLocaleCommand, "<language name>", getStaffFlagValue("None"), true, false, "Sets your language"),
|
||||
commandData("language", setLocaleCommand, "<language name>", getStaffFlagValue("None"), true, false, "Sets your language"),
|
||||
commandData("locale", setLocaleCommand, "<language name>", getStaffFlagValue("None"), true, false, "Sets your language"),
|
||||
commandData("setlang", setLocaleCommand, "<language name>", getStaffFlagValue("None"), true, false, "Sets your language"),
|
||||
],
|
||||
messaging: [],
|
||||
misc: [
|
||||
@@ -421,14 +424,14 @@ function loadCommands() {
|
||||
commandData("gotojob", gotoJobLocationCommand, "<job id/name> <location id>", getStaffFlagValue("BasicModeration"), true, true, "Teleports you to a job location by name and location ID."),
|
||||
commandData("gotoloc", gotoGameLocationCommand, "<location name>", getStaffFlagValue("BasicModeration"), true, true, "Teleports you to a game location by name."),
|
||||
commandData("gotospawn", gotoNewPlayerSpawnCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Teleports you to the new player spawn location"),
|
||||
commandData("fr", teleportForwardCommand, "<distance in meters>", getStaffFlagValue("BasicModeration"), true, true, "Teleports you forward a certain distance in meters."),
|
||||
commandData("ba", teleportBackwardCommand, "<distance in meters>", getStaffFlagValue("BasicModeration"), true, true, "Teleports you backward a certain distance in meters."),
|
||||
commandData("lt", teleportLeftCommand, "<distance in meters>", getStaffFlagValue("BasicModeration"), true, true, "Teleports you to the left a certain distance in meters."),
|
||||
commandData("rt", teleportRightCommand, "<distance in meters>", getStaffFlagValue("BasicModeration"), true, true, "Teleports you to the right a certain distance in meters."),
|
||||
commandData("up", teleportUpCommand, "<distance in meters>", getStaffFlagValue("BasicModeration"), true, true, "Teleports you upward a certain distance in meters."),
|
||||
commandData("dn", teleportDownCommand, "<distance in meters>", getStaffFlagValue("BasicModeration"), true, true, "Teleports you downward a certain distance in meters."),
|
||||
commandData("int", playerInteriorCommand, "<interior id>", getStaffFlagValue("BasicModeration"), true, true, "Gets or sets a player's game interior."),
|
||||
commandData("vw", playerVirtualWorldCommand, "<virtual world id>", getStaffFlagValue("BasicModeration"), true, true, "Gets or sets a player's virtual world/dimension."),
|
||||
commandData("fr", teleportForwardCommand, "[distance in meters]", getStaffFlagValue("BasicModeration"), true, true, "Teleports you forward a certain distance in meters."),
|
||||
commandData("ba", teleportBackwardCommand, "[distance in meters]", getStaffFlagValue("BasicModeration"), true, true, "Teleports you backward a certain distance in meters."),
|
||||
commandData("lt", teleportLeftCommand, "[distance in meters]", getStaffFlagValue("BasicModeration"), true, true, "Teleports you to the left a certain distance in meters."),
|
||||
commandData("rt", teleportRightCommand, "[distance in meters]", getStaffFlagValue("BasicModeration"), true, true, "Teleports you to the right a certain distance in meters."),
|
||||
commandData("up", teleportUpCommand, "[distance in meters]", getStaffFlagValue("BasicModeration"), true, true, "Teleports you upward a certain distance in meters."),
|
||||
commandData("dn", teleportDownCommand, "[distance in meters]", getStaffFlagValue("BasicModeration"), true, true, "Teleports you downward a certain distance in meters."),
|
||||
commandData("int", playerInteriorCommand, "<player name/id> [interior id]", getStaffFlagValue("BasicModeration"), true, true, "Gets or sets a player's game interior."),
|
||||
commandData("vw", playerVirtualWorldCommand, "<player name/id> [virtual world id]", getStaffFlagValue("BasicModeration"), true, true, "Gets or sets a player's virtual world/dimension."),
|
||||
commandData("addstaffflag", addStaffFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("ManageAdmins"), true, true, "Gives a player a staff flag by name (this server only)."),
|
||||
commandData("delstaffflag", takeStaffFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("ManageAdmins"), true, true, "Takes a player's staff flag by name (this server only)."),
|
||||
commandData("getstaffflags", getStaffFlagsCommand, "<player name/id>", getStaffFlagValue("ManageAdmins"), true, true, "Shows a list of all staff flags a player has (this server only)."),
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let serverConfig = {};
|
||||
let databaseConfig = {};
|
||||
let emailConfig = {};
|
||||
let gameConfig = {};
|
||||
let serverConfig = false;
|
||||
let databaseConfig = false;
|
||||
let emailConfig = false;
|
||||
let gameConfig = false;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -75,9 +75,22 @@ let globalConfig = {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadGameConfig() {
|
||||
return gameData;
|
||||
};
|
||||
function initConfigScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Config]: Initializing config script ...");
|
||||
logToConsole(LOG_DEBUG, "[VRR.Config]: Loading global config ...");
|
||||
loadGlobalConfig();
|
||||
|
||||
logToConsole(LOG_DEBUG, "[VRR.Config]: Loading server config ...");
|
||||
serverConfig = loadServerConfigFromGameAndPort(server.game, server.port, getMultiplayerMod());
|
||||
|
||||
logToConsole(LOG_DEBUG, "[VRR.Config]: Applying server config ...");
|
||||
applyConfigToServer(serverConfig);
|
||||
|
||||
logToConsole(LOG_DEBUG, "[VRR.Config]: All config loaded and applied successfully!");
|
||||
|
||||
logToConsole(LOG_INFO, "[VRR.Config]: Config script initialized!");
|
||||
}
|
||||
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -89,19 +102,6 @@ function loadGlobalConfig() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initConfigScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Config]: Initializing config script ...");
|
||||
gameConfig = loadGameConfig();
|
||||
serverConfig = loadServerConfigFromGameAndPort(server.game, server.port, getMultiplayerMod());
|
||||
applyConfigToServer(serverConfig);
|
||||
|
||||
loadGlobalConfig();
|
||||
|
||||
logToConsole(LOG_INFO, "[VRR.Config]: Config script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadServerConfigFromGameAndPort(gameId, port, mpMod) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
@@ -144,10 +144,12 @@ function loadServerConfigFromId(tempServerId) {
|
||||
|
||||
function applyConfigToServer(tempServerConfig) {
|
||||
if(isTimeSupported()) {
|
||||
setGameTime(tempServerConfig.hour, tempServerConfig.minute, tempServerConfig.minuteDuration)
|
||||
logToConsole(LOG_DEBUG, `[VRR.Config]: Setting time to to ${tempServerConfig.hour}:${tempServerConfig.minute} with minute duration of ${tempServerConfig.minuteDuration}`);
|
||||
setGameTime(tempServerConfig.hour, tempServerConfig.minute, tempServerConfig.minuteDuration);
|
||||
}
|
||||
|
||||
if(isWeatherSupported()) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Config]: Setting weather to ${tempServerConfig.weather}`);
|
||||
game.forceWeather(tempServerConfig.weather);
|
||||
}
|
||||
|
||||
@@ -162,13 +164,10 @@ function saveServerConfigToDatabase() {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let data = [
|
||||
["svr_logo", boolToInt(getServerConfig().showLogo)],
|
||||
["svr_gui", boolToInt(getServerConfig().useGUI)],
|
||||
["svr_settings", toInteger(getServerConfig().settings)],
|
||||
["svr_start_time_hour", getServerConfig().hour],
|
||||
["svr_start_time_min", getServerConfig().minute],
|
||||
["svr_start_weather", getServerConfig().weather],
|
||||
["svr_start_snow_falling", boolToInt(getServerConfig().fallingSnow)],
|
||||
["svr_start_snow_ground", boolToInt(getServerConfig().groundSnow)],
|
||||
["svr_newchar_pos_x", getServerConfig().newCharacter.spawnPosition.x],
|
||||
["svr_newchar_pos_y", getServerConfig().newCharacter.spawnPosition.y],
|
||||
["svr_newchar_pos_z", getServerConfig().newCharacter.spawnPosition.z],
|
||||
@@ -200,16 +199,6 @@ function saveServerConfigToDatabase() {
|
||||
["svr_charselect_int", getServerConfig().characterSelectInterior],
|
||||
["svr_charselect_vw", getServerConfig().characterSelectDimension],
|
||||
["svr_inflation_multiplier", getServerConfig().inflationMultiplier],
|
||||
["svr_ac_enabled", boolToInt(getServerConfig().antiCheat.enabled)],
|
||||
["svr_ac_check_scripts", boolToInt(getServerConfig().antiCheat.checkGameScripts)],
|
||||
["svr_ac_script_wl", boolToInt(getServerConfig().antiCheat.gameScriptWhiteListEnabled)],
|
||||
["svr_ac_script_bl", boolToInt(getServerConfig().antiCheat.gameScriptBlackListEnabled)],
|
||||
["svr_job_pickups", boolToInt(getServerConfig().createJobPickups)],
|
||||
["svr_job_blips", boolToInt(getServerConfig().createJobBlips)],
|
||||
["svr_biz_pickups", boolToInt(getServerConfig().createBusinessPickups)],
|
||||
["svr_biz_blips", boolToInt(getServerConfig().createBusinessBlips)],
|
||||
["svr_house_pickups", boolToInt(getServerConfig().createHousePickups)],
|
||||
["svr_house_blips", boolToInt(getServerConfig().createHouseBlips)],
|
||||
["svr_intro_music", getServerConfig().introMusicURL],
|
||||
];
|
||||
|
||||
@@ -230,27 +219,29 @@ function saveServerConfigToDatabase() {
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {ServerConfigData} - Server configuration data
|
||||
* @return {ServerData} - Server configuration data
|
||||
*
|
||||
*/
|
||||
function getServerConfig() {
|
||||
//if(serverId != getServerId()) {
|
||||
// return loadServerConfigFromId(serverId);
|
||||
//}
|
||||
return serverConfig;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getGameConfig() {
|
||||
return gameConfig;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getGlobalConfig() {
|
||||
return globalConfig;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {number} - This server's ID
|
||||
*
|
||||
*/
|
||||
function getServerId() {
|
||||
return getServerConfig().databaseId;
|
||||
}
|
||||
@@ -356,7 +347,7 @@ function setWeatherCommand(command, params, client) {
|
||||
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} set the weather to {ALTCOLOUR}${getGameData().weatherNames[getServerGame()][toInteger(weatherId)]}`);
|
||||
messageAdminAction(`${getPlayerName(client)} set the weather to {ALTCOLOUR}${getGameConfig().weatherNames[getServerGame()][toInteger(weatherId)]}`);
|
||||
updateServerRules();
|
||||
return true;
|
||||
}
|
||||
@@ -447,7 +438,7 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
|
||||
updatePlayerShowLogoState(null, getServerConfig().useLogo);
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned the server logo image ${getBoolRedGreenInlineColour(getServerConfig().useLogo)}${toUpperCase(getOnOffFromBool(getServerConfig().useLogo))}`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned the server logo image ${getBoolRedGreenInlineColour(doesServerHaveServerLogoEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().useLogo))}`);
|
||||
updateServerRules();
|
||||
return true;
|
||||
}
|
||||
@@ -467,7 +458,7 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
getServerConfig().createJobBlips = !getServerConfig().createJobBlips;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(getServerConfig().createJobBlips)}${toUpperCase(getOnOffFromBool(getServerConfig().createJobBlips))} {MAINCOLOUR}all job blips`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobBlips))} {MAINCOLOUR}all job blips`);
|
||||
resetAllJobBlips();
|
||||
return true;
|
||||
}
|
||||
@@ -487,7 +478,7 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
getServerConfig().createJobPickups = !getServerConfig().createJobPickups;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(getServerConfig().createJobPickups)}${toUpperCase(getOnOffFromBool(getServerConfig().createJobPickups))} {MAINCOLOUR}all job pickups`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobPickups))} {MAINCOLOUR}all job pickups`);
|
||||
resetAllJobPickups();
|
||||
return true;
|
||||
}
|
||||
@@ -504,10 +495,10 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerBusinessBlipsCommand(command, params, client) {
|
||||
getServerConfig().createBusinessBlips = !getServerConfig().createBusinessBlips;
|
||||
getServerConfig().createBusinessBlips = !getServerConfig().createBusinessBlips;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(getServerConfig().createBusinessBlips)}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessBlips))} {MAINCOLOUR}all business blips`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessBlips))} {MAINCOLOUR}all business blips`);
|
||||
resetAllBusinessBlips();
|
||||
return true;
|
||||
}
|
||||
@@ -524,10 +515,10 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerBusinessPickupsCommand(command, params, client) {
|
||||
getServerConfig().createBusinessPickups = !getServerConfig().createBusinessPickups;
|
||||
getServerConfig().createBusinessPickups = !getServerConfig().createBusinessPickups;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(getServerConfig().createBusinessPickups)}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessPickups))} {MAINCOLOUR}all business pickups`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessPickups))} {MAINCOLOUR}all business pickups`);
|
||||
resetAllBusinessPickups();
|
||||
return true;
|
||||
}
|
||||
@@ -544,10 +535,10 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerHouseBlipsCommand(command, params, client) {
|
||||
getServerConfig().createHouseBlips = !getServerConfig().createHouseBlips;
|
||||
getServerConfig().createHouseBlips = !getServerConfig().createHouseBlips;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(getServerConfig().createHouseBlips)}${toUpperCase(getOnOffFromBool(getServerConfig().createHouseBlips))} {MAINCOLOUR}all house blips`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHouseBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHouseBlips))} {MAINCOLOUR}all house blips`);
|
||||
resetAllHouseBlips();
|
||||
return true;
|
||||
}
|
||||
@@ -567,7 +558,7 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
getServerConfig().createHousePickups = !getServerConfig().createHousePickups;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(getServerConfig().createHousePickups)}${toUpperCase(getOnOffFromBool(getServerConfig().createHousePickups))} {MAINCOLOUR}all house pickups`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHousePickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHousePickups))} {MAINCOLOUR}all house pickups`);
|
||||
resetAllHousePickups();
|
||||
return true;
|
||||
}
|
||||
@@ -584,10 +575,11 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerGUICommand(command, params, client) {
|
||||
getServerConfig().useGUI = !getServerConfig().useGUI;
|
||||
getServerConfig().useGUI = !getServerConfig().useGUI;
|
||||
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned GUI ${toLowerCase(getOnOffFromBool(getServerConfig().useGUI))} for this server`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned GUI ${toLowerCase(getOnOffFromBool(doesServerHaveGUIEnabled()))} for this server`);
|
||||
updateServerRules();
|
||||
return true;
|
||||
}
|
||||
@@ -604,10 +596,11 @@ function toggleServerGUICommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerUseRealWorldTimeCommand(command, params, client) {
|
||||
getServerConfig().useRealTime = !getServerConfig().useRealTime;
|
||||
getServerConfig().useRealTime = !getServerConfig().useRealTime;
|
||||
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned real-world time ${toLowerCase(getOnOffFromBool(getServerConfig().useRealTime))} for this server (GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)})`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned real-world time ${getServerConfig().useRealTime} for this server (GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)})`);
|
||||
updateServerGameTime();
|
||||
updateServerRules();
|
||||
return true;
|
||||
@@ -737,4 +730,70 @@ function loadAccentConfig() {
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveGUIEnabled() {
|
||||
return getServerConfig().useGUI;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveTesterOnlyEnabled() {
|
||||
return getServerConfig().testerOnly;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveRealTimeEnabled() {
|
||||
return getServerConfig().useRealTime;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveBusinessPickupsEnabled() {
|
||||
return getServerConfig().createBusinessPickups
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveHousePickupsEnabled() {
|
||||
return getServerConfig().createHousePickups;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveJobPickupsEnabled() {
|
||||
return getServerConfig().createJobPickups;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveBusinesBlipsEnabled() {
|
||||
return getServerConfig().createBusinessBlips;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveHouseBlipsEnabled() {
|
||||
return getServerConfig().createHouseBlips;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveJobBlipsEnabled() {
|
||||
return getServerConfig().createJobBlips;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveFallingSnowEnabled() {
|
||||
return getServerConfig().fallingSnow;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveGroundSnowEnabled() {
|
||||
return getServerConfig().groundSnow;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
let scriptVersion = "1.0";
|
||||
let serverStartTime = 0;
|
||||
let logLevel = LOG_ERROR|LOG_WARN|LOG_INFO;
|
||||
let logLevel = LOG_DEBUG;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ function executeClientCodeCommand(command, params, client) {
|
||||
let targetCode = splitParams.slice(1).join(" ");
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player was not found!");
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -359,6 +359,33 @@ function executeClientCodeCommand(command, params, client) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerTesterStatusCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!hasBitFlag(getPlayerData(targetClient).accountData.flags.moderation, getModerationFlagValue("IsTester"))) {
|
||||
getPlayerData(targetClient).accountData.flags.moderation = addBitFlag(getPlayerData(targetClient).accountData.flags.moderation, getModerationFlagValue("IsTester"));
|
||||
} else {
|
||||
getPlayerData(targetClient).accountData.flags.moderation = removeBitFlag(getPlayerData(targetClient).accountData.flags.moderation, getModerationFlagValue("IsTester"));
|
||||
}
|
||||
|
||||
let enabled = hasBitFlag(getPlayerData(targetClient).accountData.flags.moderation, getModerationFlagValue("IsTester"));
|
||||
|
||||
messageAdminAction(`{ALTCOLOUR}${client.name} ${getBoolRedGreenInlineColour(enabled)}${toUpperCase(getEnabledDisabledFromBool(enabled))} {ALTCOLOUR}${targetClient.name}'s {MAINCOLOUR}tester status`)
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function saveAllServerDataCommand(command, params, client) {
|
||||
messageAdmins(`{clanOrange}Vortrex has forced a manual save of all data. Initiating ...`);
|
||||
saveAllServerDataToDatabase();
|
||||
|
||||
@@ -408,7 +408,7 @@ function onPlayerDeath(client, position) {
|
||||
client.despawnPlayer();
|
||||
getPlayerCurrentSubAccount(client).interior = closestJail.interior;
|
||||
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension;
|
||||
spawnPlayer(client, closestJail.position, closestJail.heading, getGameData().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
@@ -421,7 +421,7 @@ function onPlayerDeath(client, position) {
|
||||
client.despawnPlayer();
|
||||
getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
|
||||
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension;
|
||||
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameData().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
|
||||
@@ -99,7 +99,7 @@ function playerPromptAnswerYes(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function canPlayerUseGUI(client) {
|
||||
return (getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client));
|
||||
return (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -873,11 +873,13 @@ function createHouseEntrancePickup(houseId) {
|
||||
pickupModelId = getHouseData(houseId).entrancePickupModel;
|
||||
}
|
||||
|
||||
getHouseData(houseId).entrancePickup = createGamePickup(pickupModelId, getHouseData(houseId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].house);
|
||||
setElementOnAllDimensions(getHouseData(houseId).entrancePickup, false);
|
||||
setElementDimension(getHouseData(houseId).entrancePickup, getHouseData(houseId).entranceDimension);
|
||||
|
||||
addToWorld(getHouseData(houseId).entrancePickup);
|
||||
if(areServerElementsSupported()) {
|
||||
getHouseData(houseId).entrancePickup = createGamePickup(pickupModelId, getHouseData(houseId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].house);
|
||||
setElementOnAllDimensions(getHouseData(houseId).entrancePickup, false);
|
||||
setElementDimension(getHouseData(houseId).entrancePickup, getHouseData(houseId).entranceDimension);
|
||||
addToWorld(getHouseData(houseId).entrancePickup);
|
||||
}
|
||||
updateHousePickupLabelData(houseId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -895,14 +897,16 @@ function createHouseEntranceBlip(houseId) {
|
||||
blipModelId = getHouseData(houseId).entranceBlipModel;
|
||||
}
|
||||
|
||||
getHouseData(houseId).entranceBlip = createGameBlip(getHouseData(houseId).entrancePosition, blipModelId, 1, getColourByName("houseGreen"));
|
||||
setElementDimension(getHouseData(houseId).entranceBlip, getHouseData(houseId).entranceDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).entranceBlip, false);
|
||||
//getHouseData(houseId).entranceBlip.streamInDistance = 300;
|
||||
//getHouseData(houseId).entranceBlip.streamOutDistance = 350;
|
||||
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
|
||||
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.id", houseId, false);
|
||||
addToWorld(getHouseData(houseId).entranceBlip);
|
||||
if(areServerElementsSupported()) {
|
||||
getHouseData(houseId).entranceBlip = createGameBlip(getHouseData(houseId).entrancePosition, blipModelId, 1, getColourByName("houseGreen"));
|
||||
setElementDimension(getHouseData(houseId).entranceBlip, getHouseData(houseId).entranceDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).entranceBlip, false);
|
||||
//getHouseData(houseId).entranceBlip.streamInDistance = 300;
|
||||
//getHouseData(houseId).entranceBlip.streamOutDistance = 350;
|
||||
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
|
||||
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.id", houseId, false);
|
||||
addToWorld(getHouseData(houseId).entranceBlip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -921,11 +925,13 @@ function createHouseExitPickup(houseId) {
|
||||
pickupModelId = getHouseData(houseId).exitPickupModel;
|
||||
}
|
||||
|
||||
getHouseData(houseId).exitPickup = createGamePickup(pickupModelId, getHouseData(houseId).exitPosition, getGameConfig().pickupTypes[getServerGame()].house);
|
||||
setElementDimension(getHouseData(houseId).exitPickup, getHouseData(houseId).exitDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).exitPickup, false);
|
||||
updateHousePickupLabelData(houseId);
|
||||
addToWorld(getHouseData(houseId).exitPickup);
|
||||
if(areServerElementsSupported()) {
|
||||
getHouseData(houseId).exitPickup = createGamePickup(pickupModelId, getHouseData(houseId).exitPosition, getGameConfig().pickupTypes[getServerGame()].house);
|
||||
setElementDimension(getHouseData(houseId).exitPickup, getHouseData(houseId).exitDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).exitPickup, false);
|
||||
addToWorld(getHouseData(houseId).exitPickup);
|
||||
}
|
||||
updateHousePickupLabelData(houseId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -945,12 +951,14 @@ function createHouseExitBlip(houseId) {
|
||||
blipModelId = getHouseData(houseId).exitBlipModel;
|
||||
}
|
||||
|
||||
getHouseData(houseId).exitBlip = createGameBlip(blipModelId, getHouseData(houseId).exitPosition, 1, getColourByName("houseGreen"));
|
||||
setElementDimension(getHouseData(houseId).exitBlip, getHouseData(houseId).entranceDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).exitBlip, false);
|
||||
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false);
|
||||
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.id", houseId, false);
|
||||
addToWorld(getHouseData(houseId).exitBlip);
|
||||
if(areServerElementsSupported()) {
|
||||
getHouseData(houseId).exitBlip = createGameBlip(blipModelId, getHouseData(houseId).exitPosition, 1, getColourByName("houseGreen"));
|
||||
setElementDimension(getHouseData(houseId).exitBlip, getHouseData(houseId).entranceDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).exitBlip, false);
|
||||
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false);
|
||||
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.id", houseId, false);
|
||||
addToWorld(getHouseData(houseId).exitBlip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1403,6 +1411,10 @@ function getHouseFromParams(params) {
|
||||
// ===========================================================================
|
||||
|
||||
function updateHousePickupLabelData(houseId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let houseData = getHouseData(houseId);
|
||||
|
||||
if(houseData.entrancePickup != null) {
|
||||
|
||||
@@ -1264,9 +1264,9 @@ function deleteItem(itemId) {
|
||||
ownerTypeString = "Player";
|
||||
owner = getPlayerFromCharacterId(getItemData(itemId).ownerId);
|
||||
if(getPlayerData(owner) != false) {
|
||||
switchPlayerActiveHotBarSlot(getPlayerData(owner), -1);
|
||||
switchPlayerActiveHotBarSlot(owner, -1);
|
||||
getPlayerData(owner).hotBarItems[getPlayerData(owner).hotBarItems.indexOf(itemId)] = -1;
|
||||
updatePlayerHotBar(getPlayerData(owner));
|
||||
updatePlayerHotBar(owner);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1732,7 +1732,7 @@ function getItemValueDisplay(itemType, value) {
|
||||
} else if(getItemTypeData(itemType).useType == VRR_ITEM_USETYPE_WALKIETALKIE) {
|
||||
return toString(toString(value).slice(0,-2)+"."+toString(value).slice(-1)+"MHz");
|
||||
} else if(getItemTypeData(itemType).useType == VRR_ITEM_USETYPE_VEHCOLOUR) {
|
||||
return `[${getGameData().vehicleColourHex[value]}]SAMPLE[#FFFFFF]`;
|
||||
return `[${getGameConfig().vehicleColourHex[value]}]SAMPLE[#FFFFFF]`;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -962,8 +962,8 @@ function createJob(name) {
|
||||
tempJobData.name = name;
|
||||
tempJobData.enabled = true;
|
||||
tempJobData.needsSaved = true;
|
||||
tempJobData.blipModel = getGameData().blipSprites[getGame()].job;
|
||||
tempJobData.pickupModel = getGameData().pickupModels[getGame()].job;
|
||||
tempJobData.blipModel = getGameConfig().blipSprites[getGame()].job;
|
||||
tempJobData.pickupModel = getGameConfig().pickupModels[getGame()].job;
|
||||
|
||||
getServerData().jobs.push(tempJobData);
|
||||
saveJobToDatabase(tempJobData);
|
||||
|
||||
@@ -6,3 +6,159 @@
|
||||
// DESC: Provides police officer job functions and usage
|
||||
// TYPE: Job (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
function policeTazerCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!canPlayerUsePoliceJob(client)) {
|
||||
messagePlayerError(client, "You are not allowed to use the police job.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerWorking(client)) {
|
||||
messagePlayerError(client, "You are not working! Use /startwork first.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
||||
messagePlayerError(client, "You don't have a police job.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function policeCuffCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!canPlayerUsePoliceJob(client)) {
|
||||
messagePlayerError(client, "You are not allowed to use the police job.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerWorking(client)) {
|
||||
messagePlayerError(client, "You are not working! Use /startwork first.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
||||
messagePlayerError(client, "You don't have a police job.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function policeArrestCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!canPlayerUsePoliceJob(client)) {
|
||||
messagePlayerError(client, "You are not allowed to use the police job.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerWorking(client)) {
|
||||
messagePlayerError(client, "You are not working! Use /startwork first.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
||||
messagePlayerError(client, "You don't have a police job.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function policeSearchCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!canPlayerUsePoliceJob(client)) {
|
||||
messagePlayerError(client, "You are not allowed to use the police job.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerWorking(client)) {
|
||||
messagePlayerError(client, "You are not working! Use /startwork first.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
||||
messagePlayerError(client, "You don't have a police job.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function policeDragCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!canPlayerUsePoliceJob(client)) {
|
||||
messagePlayerError(client, "You are not allowed to use the police job.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerWorking(client)) {
|
||||
messagePlayerError(client, "You are not working! Use /startwork first.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
||||
messagePlayerError(client, "You don't have a police job.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function policeDetainCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!canPlayerUsePoliceJob(client)) {
|
||||
messagePlayerError(client, "You are not allowed to use the police job.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerWorking(client)) {
|
||||
messagePlayerError(client, "You are not working! Use /startwork first.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
||||
messagePlayerError(client, "You don't have a police job.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -163,13 +163,13 @@ function messagePlayerWhisper(client, whisperingClient, messageText) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerShout(client, shoutingClient, messageText) {
|
||||
function messagePlayerMegaPhone(client, shoutingClient, messageText) {
|
||||
messagePlayerNormal(client, `📢 ${getPlayerAccentInlineOutput(shoutingClient)}${getClientSubAccountName(shoutingClient)} (megaphone): ${messageText}!`, getColourByType("yellow"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerMegaPhone(client, shoutingClient, messageText) {
|
||||
function messagePlayerShout(client, shoutingClient, messageText) {
|
||||
messagePlayerNormal(client, `🗣️ ${getPlayerAccentInlineOutput(shoutingClient)}${getClientSubAccountName(shoutingClient)} shouts: ${messageText}!`, getColourByType("shoutMessage"));
|
||||
}
|
||||
|
||||
|
||||
@@ -120,40 +120,70 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
let isEntrance = false;
|
||||
let isBusiness = false;
|
||||
|
||||
if(!getPlayerData(client).currentPickup) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let ownerType = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.type");
|
||||
let ownerId = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.id");
|
||||
|
||||
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:
|
||||
if(areServerElementsSupported()) {
|
||||
if(!getPlayerData(client).currentPickup) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let ownerType = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.type");
|
||||
let ownerId = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.id");
|
||||
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
for(let i in getServerData().businesses) {
|
||||
if(getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()] && getPlayerInterior(client) == getGameConfig().mainWorldInterior[getGame()]) {
|
||||
let businessId = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
|
||||
isBusiness = true;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().businesses[businessId];
|
||||
} else {
|
||||
let businessId = getClosestBusinessExit(getPlayerPosition(client), getPlayerDimension(client));
|
||||
isBusiness = true;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().businesses[businessId];
|
||||
}
|
||||
}
|
||||
|
||||
for(let j in getServerData().houses) {
|
||||
if(getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()] && getPlayerInterior(client) == getGameConfig().mainWorldInterior[getGame()]) {
|
||||
let houseId = getClosestHouseEntrance(getPlayerPosition(client), getPlayerDimension(client));
|
||||
isBusiness = false;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().businesses[houseId];
|
||||
} else {
|
||||
let houseId = getClosestHouseExit(getPlayerPosition(client), getPlayerDimension(client));
|
||||
isBusiness = false;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().businesses[houseId];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(closestProperty == null) {
|
||||
@@ -451,7 +481,7 @@ function gpsCommand(command, params, client) {
|
||||
} else {
|
||||
let gameLocationId = getGameLocationFromParams(params);
|
||||
if(gameLocationId != false) {
|
||||
position = getGameData().locations[getServerGame()][gameLocationId][1]
|
||||
position = getGameConfig().locations[getServerGame()][gameLocationId][1]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -548,8 +578,8 @@ function stuckPlayerCommand(command, params, client) {
|
||||
}
|
||||
} else {
|
||||
setPlayerDimension(client, 1);
|
||||
setPlayerDimension(client, getGameData().mainWorldDimension[getGame()]);
|
||||
setPlayerInterior(client, getGameData().mainWorldInterior[getGame()]);
|
||||
setPlayerDimension(client, getGameConfig().mainWorldDimension[getGame()]);
|
||||
setPlayerInterior(client, getGameConfig().mainWorldInterior[getGame()]);
|
||||
setPlayerPosition(client, getPosAbovePos(getPlayerPosition(client), 2.0));
|
||||
}
|
||||
|
||||
|
||||
@@ -195,8 +195,12 @@ function removePlayerFromVehicle(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerSkin(client, skinIndex) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s skin to ${getGameData().skins[getGame()][skinIndex][0]} (Index: ${skinIndex}, Name: ${getGameData().skins[getGame()][skinIndex][1]})`);
|
||||
client.player.modelIndex = getGameData().skins[getGame()][skinIndex][0];
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s skin to ${getGameConfig().skins[getGame()][skinIndex][0]} (Index: ${skinIndex}, Name: ${getGameConfig().skins[getGame()][skinIndex][1]})`);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
triggerNetworkEvent("vrr.localPlayerSkin", client, getGameConfig().skins[getGame()][skinIndex][0]);
|
||||
} else {
|
||||
client.player.modelIndex = getGameConfig().skins[getGame()][skinIndex][0];
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -413,7 +417,7 @@ function createGameObject(modelIndex, position) {
|
||||
if(!isGameFeatureSupported("objects")) {
|
||||
return false;
|
||||
}
|
||||
return game.createObject(getGameData().objects[getGame()][modelIndex][0], position);
|
||||
return game.createObject(getGameConfig().objects[getGame()][modelIndex][0], position);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -435,7 +439,7 @@ function destroyGameElement(element) {
|
||||
// ===========================================================================
|
||||
|
||||
function isMeleeWeapon(weaponId, gameId = getServerGame()) {
|
||||
return (getGameData().meleeWeapons[gameId].indexOf(weaponId) != -1);
|
||||
return (getGameConfig().meleeWeapons[gameId].indexOf(weaponId) != -1);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -523,7 +527,7 @@ function setVehicleColours(vehicle, colour1, colour2, colour3 = -1, colour4 = -1
|
||||
// ===========================================================================
|
||||
|
||||
function createGameVehicle(modelIndex, position, heading) {
|
||||
return game.createVehicle(getGameData().vehicles[getGame()][modelIndex][0], position, heading);
|
||||
return game.createVehicle(getGameConfig().vehicles[getGame()][modelIndex][0], position, heading);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -574,7 +578,7 @@ function setPlayerFightStyle(client, fightStyleId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
setEntityData(getPlayerElement(client), "vrr.fightStyle", [getGameData().fightStyles[getServerGame()][fightStyleId][1][0], getGameData().fightStyles[getServerGame()][fightStyleId][1][1]]);
|
||||
setEntityData(getPlayerElement(client), "vrr.fightStyle", [getGameConfig().fightStyles[getServerGame()][fightStyleId][1][0], getGameConfig().fightStyles[getServerGame()][fightStyleId][1][1]]);
|
||||
forcePlayerToSyncElementProperties(null, getPlayerElement(client));
|
||||
}
|
||||
|
||||
@@ -1009,4 +1013,11 @@ function setVehicleHealth(vehicle, health) {
|
||||
vehicle.health = 1000;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerWeapon(client, weaponId, ammo, active = true) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
||||
sendNetworkEventToPlayer("vrr.giveWeapon", client, weaponId, ammo, active);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -374,19 +374,19 @@ function gotoGameLocationCommand(command, params, client) {
|
||||
}
|
||||
|
||||
setPlayerVelocity(client, toVector3(0.0, 0.0, 0.0));
|
||||
setPlayerPosition(client, getGameData().locations[getServerGame()][gameLocationId][1]);
|
||||
setPlayerPosition(client, getGameConfig().locations[getServerGame()][gameLocationId][1]);
|
||||
setPlayerInterior(client, 0);
|
||||
setPlayerDimension(client, 0);
|
||||
updateInteriorLightsForPlayer(client, true);
|
||||
|
||||
//setTimeout(function() {
|
||||
// setPlayerPosition(client, getGameData().locations[getServerGame()][gameLocationId][1]);
|
||||
// setPlayerPosition(client, getGameConfig().locations[getServerGame()][gameLocationId][1]);
|
||||
// setPlayerInterior(client, 0);
|
||||
// setPlayerDimension(client, 0);
|
||||
// updateInteriorLightsForPlayer(client, true);
|
||||
//}, 500);
|
||||
|
||||
messagePlayerSuccess(client, `You teleported to game location {ALTCOLOUR}${getGameData().locations[getServerGame()][gameLocationId][0]}`);
|
||||
messagePlayerSuccess(client, `You teleported to game location {ALTCOLOUR}${getGameConfig().locations[getServerGame()][gameLocationId][0]}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1003,20 +1003,24 @@ function forcePlayerSkinCommand(command, params, client) {
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let skinIndex = getSkinModelIndexFromParams(splitParams.slice(1).join(" "), getGame());
|
||||
|
||||
console.warn(targetClient.name);
|
||||
console.warn(splitParams.slice(1).join(" "));
|
||||
console.warn(skinIndex);
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!skinIndex) {
|
||||
messagePlayerError(client, "That skin is invalid!");
|
||||
if(skinIndex == false) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidSkin"));
|
||||
return false;
|
||||
}
|
||||
|
||||
getPlayerCurrentSubAccount(targetClient).skin = skinIndex;
|
||||
setPlayerSkin(targetClient, skinIndex);
|
||||
|
||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s{MAINCOLOUR} skin to {ALTCOLOUR}${getGameData().skins[getGame()][skinIndex][1]}`);
|
||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s{MAINCOLOUR} skin to {ALTCOLOUR}${getGameConfig().skins[getGame()][skinIndex][1]}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1112,7 +1116,7 @@ function forcePlayerWantedLevelCommand(command, params, client) {
|
||||
|
||||
forcePlayerWantedLevel(targetClient, wantedLevel);
|
||||
|
||||
//messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s {MAINCOLOUR}skin to {ALTCOLOUR}${getGameData().skins[getGame()][skinIndex][1]}`);
|
||||
//messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s {MAINCOLOUR}skin to {ALTCOLOUR}${getGameConfig().skins[getGame()][skinIndex][1]}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -40,11 +40,12 @@ function initServerScripts() {
|
||||
initLocaleScript();
|
||||
|
||||
initCommandScript();
|
||||
initTimers();
|
||||
|
||||
serverStartTime = getCurrentUnixTimestamp();
|
||||
|
||||
initAllClients();
|
||||
|
||||
initTimers();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -231,13 +231,13 @@ function showCharacterSelectToClient(client) {
|
||||
}
|
||||
}
|
||||
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
getPlayerData(client).currentSubAccount = 0;
|
||||
logToConsole(LOG_DEBUG, `[VRR.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
||||
let tempSubAccount = getPlayerData(client).subAccounts[0];
|
||||
let ClanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None";
|
||||
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp()-tempSubAccount.lastLogin)} ago` : "Never";
|
||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, ClanName, lastPlayedText, getGameData().skins[getGame()][tempSubAccount.skin][0]);
|
||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, ClanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
|
||||
|
||||
//spawnPlayer(client, getServerConfig().characterSelectPedPosition, getServerConfig().characterSelectPedHeading, getPlayerCurrentSubAccount(client).skin, getServerConfig().characterSelectInterior, getServerConfig().characterSelectDimension);
|
||||
//setTimeout(function() {
|
||||
@@ -290,10 +290,10 @@ function checkNewCharacter(client, firstName, lastName) {
|
||||
|
||||
let subAccountData = createSubAccount(getPlayerData(client).accountData.databaseId, firstName, lastName);
|
||||
if(!subAccountData) {
|
||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerNewCharacterFailedGUI(client, "Your character could not be created!");
|
||||
} else {
|
||||
messagePlayerAlert(client, "Your character could not be created!");
|
||||
messagePlayerError(client, "Your character could not be created!");
|
||||
}
|
||||
messagePlayerAlert(client, `${getServerName()} staff have been notified of the problem and will fix it soon.`);
|
||||
return false;
|
||||
@@ -321,7 +321,7 @@ function checkPreviousCharacter(client) {
|
||||
|
||||
let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None";
|
||||
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp()-tempSubAccount.lastLogin)} ago` : "Never";
|
||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameData().skins[getGame()][tempSubAccount.skin][0]);
|
||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
||||
}
|
||||
@@ -342,7 +342,7 @@ function checkNextCharacter(client) {
|
||||
|
||||
let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None";
|
||||
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp()-tempSubAccount.lastLogin)} ago` : "Never";
|
||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameData().skins[getGame()][tempSubAccount.skin][0]);
|
||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
||||
}
|
||||
@@ -371,10 +371,12 @@ function selectCharacter(client, characterId = -1) {
|
||||
//setPlayerCameraLookAt(client, getPosBehindPos(spawnPosition, spawnHeading, 5), spawnPosition);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_SPAWNING;
|
||||
|
||||
if(getGame() < VRR_GAME_MAFIA_ONE) {
|
||||
spawnPlayer(client, spawnPosition, spawnHeading, getGameData().skins[getGame()][skin][0], spawnInterior, spawnDimension);
|
||||
} else {
|
||||
spawnPlayer(client, getGameData().skins[getGame()][skin][0], spawnPosition, spawnHeading);
|
||||
if(getGame() < VRR_GAME_GTA_IV) {
|
||||
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
|
||||
} else if(getGame() == VRR_GAME_GTA_IV) {
|
||||
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
|
||||
} else if(getGame() >= VRR_GAME_MAFIA_ONE) {
|
||||
spawnPlayer(client, getGameConfig().skins[getGame()][skin][0], spawnPosition, spawnHeading);
|
||||
}
|
||||
|
||||
removePlayerKeyBind(client, getKeyIdFromParams("insert"));
|
||||
@@ -515,7 +517,7 @@ function setFightStyleCommand(command, params, client) {
|
||||
|
||||
if(!fightStyle) {
|
||||
messagePlayerError(client, `That fight style doesn't exist!`);
|
||||
messagePlayerError(client, `Fight styles: ${getGameData().fightStyles[getServerGame()].map(fs => fs[0]).join(", ")}`);
|
||||
messagePlayerError(client, `Fight styles: ${getGameConfig().fightStyles[getServerGame()].map(fs => fs[0]).join(", ")}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -527,7 +529,7 @@ function setFightStyleCommand(command, params, client) {
|
||||
}
|
||||
|
||||
setPlayerFightStyle(client, fightStyleId);
|
||||
messagePlayerSuccess(client, `Your fight style has been set to ${getGameData().fightStyles[getServerGame()][fightStyleId][0]}`)
|
||||
messagePlayerSuccess(client, `Your fight style has been set to ${getGameConfig().fightStyles[getServerGame()][fightStyleId][0]}`)
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -560,13 +562,13 @@ function forceFightStyleCommand(command, params, client) {
|
||||
|
||||
if(!fightStyleId) {
|
||||
messagePlayerError(client, `That fight style doesn't exist!`);
|
||||
messagePlayerError(client, `Fight styles: ${getGameData().fightStyles[getServerGame()].map(fs => fs[0]).join(", ")}`);
|
||||
messagePlayerError(client, `Fight styles: ${getGameConfig().fightStyles[getServerGame()].map(fs => fs[0]).join(", ")}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
getPlayerCurrentSubAccount(client).fightStyle = fightStyleId;
|
||||
setPlayerFightStyle(client, fightStyleId);
|
||||
messagePlayerSuccess(client, `You set ${getCharacterFullName(targetClient)}'s fight style to ${getGameData().fightStyles[getServerGame()][fightStyleId][0]}`)
|
||||
messagePlayerSuccess(client, `You set ${getCharacterFullName(targetClient)}'s fight style to ${getGameConfig().fightStyles[getServerGame()][fightStyleId][0]}`)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -11,14 +11,6 @@ let serverTimers = {};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updateTimeRule() {
|
||||
if(isTimeSupported()) {
|
||||
server.setRule("Time", makeReadableTime(game.time.hour, game.time.minute));
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function saveAllServerDataToDatabase() {
|
||||
if(getServerConfig().pauseSavingToDatabase) {
|
||||
return false;
|
||||
@@ -188,7 +180,7 @@ function updatePings() {
|
||||
// ===========================================================================
|
||||
|
||||
function checkServerGameTime() {
|
||||
if(!getServerConfig().useRealTime) {
|
||||
//if(!getServerConfig().useRealTime) {
|
||||
if(getServerConfig().minute >= 59) {
|
||||
getServerConfig().minute = 0;
|
||||
if(getServerConfig().hour >= 23) {
|
||||
@@ -199,11 +191,11 @@ function checkServerGameTime() {
|
||||
} else {
|
||||
getServerConfig().minute = getServerConfig().minute + 1;
|
||||
}
|
||||
} else {
|
||||
let dateTime = getCurrentTimeStampWithTimeZone(getServerConfig().realTimeZone);
|
||||
getServerConfig().hour = dateTime.getHours();
|
||||
getServerConfig().minute = dateTime.getMinutes();
|
||||
}
|
||||
//} else {
|
||||
// let dateTime = getCurrentTimeStampWithTimeZone(getServerConfig().realTimeZone);
|
||||
// getServerConfig().hour = dateTime.getHours();
|
||||
// getServerConfig().minute = dateTime.getMinutes();
|
||||
//}
|
||||
|
||||
updateTimeRule();
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ function getAreaName(position) {
|
||||
// ===========================================================================
|
||||
|
||||
function getGameAreas(gameId) {
|
||||
return getGameData().areas[gameId];
|
||||
return getGameConfig().areas[gameId];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -79,30 +79,46 @@ function initAllClients() {
|
||||
// ===========================================================================
|
||||
|
||||
function updateServerRules() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Updating all server rules ...`);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Time support: ${isTimeSupported()}`);
|
||||
if(isTimeSupported()) {
|
||||
server.setRule("Time", makeReadableTime(getServerConfig().hour, getServerConfig().minute));
|
||||
if(getServerConfig() != false) {
|
||||
let value = makeReadableTime(getServerConfig().hour, getServerConfig().minute);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Setting server rule "Time" as ${value}`);
|
||||
server.setRule("Time", value);
|
||||
}
|
||||
}
|
||||
|
||||
if(isWeatherSupported()) {
|
||||
server.setRule("Weather", getGameData().weatherNames[getServerGame()][getServerConfig().weather]);
|
||||
if(getServerConfig() != false) {
|
||||
let value = getGameConfig().weatherNames[getServerGame()][getServerConfig().weather];
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Setting server rule "Weather" as ${value}`);
|
||||
server.setRule("Weather", value);
|
||||
}
|
||||
}
|
||||
|
||||
if(isSnowSupported()) {
|
||||
server.setRule("Snowing", getYesNoFromBool(getServerConfig().fallingSnow));
|
||||
if(getServerConfig() != false) {
|
||||
let value = getYesNoFromBool(getServerConfig().fallingSnow);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Setting server rule "Snowing" as ${value}`);
|
||||
server.setRule("Snowing", value);
|
||||
}
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities]: All server rules updated successfully!`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getWeatherFromParams(params) {
|
||||
if(isNaN(params)) {
|
||||
for(let i in getGameData().weatherNames[getServerGame()]) {
|
||||
if(toLowerCase(getGameData().weatherNames[getServerGame()][i]).indexOf(toLowerCase(params)) != -1) {
|
||||
for(let i in getGameConfig().weatherNames[getServerGame()]) {
|
||||
if(toLowerCase(getGameConfig().weatherNames[getServerGame()][i]).indexOf(toLowerCase(params)) != -1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(typeof getGameData().weatherNames[getServerGame()][params] != "undefined") {
|
||||
if(typeof getGameConfig().weatherNames[getServerGame()][params] != "undefined") {
|
||||
return toInteger(params);
|
||||
}
|
||||
}
|
||||
@@ -114,13 +130,13 @@ function getWeatherFromParams(params) {
|
||||
|
||||
function getFightStyleFromParams(params) {
|
||||
if(isNaN(params)) {
|
||||
for(let i in getGameData().fightStyles[getServerGame()]) {
|
||||
if(toLowerCase(getGameData().fightStyles[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
|
||||
for(let i in getGameConfig().fightStyles[getServerGame()]) {
|
||||
if(toLowerCase(getGameConfig().fightStyles[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(typeof getGameData().fightStyles[getServerGame()][params] != "undefined") {
|
||||
if(typeof getGameConfig().fightStyles[getServerGame()][params] != "undefined") {
|
||||
return toInteger(params);
|
||||
}
|
||||
}
|
||||
@@ -132,26 +148,26 @@ function getFightStyleFromParams(params) {
|
||||
|
||||
function getClosestHospital(position) {
|
||||
let closest = 0;
|
||||
for(let i in getGameData().hospitals[getServerGame()]) {
|
||||
if(getDistance(getGameData().hospitals[getServerGame()][i].position, position) < getDistance(getGameData().hospitals[getServerGame()][closest].position, position)) {
|
||||
for(let i in getGameConfig().hospitals[getServerGame()]) {
|
||||
if(getDistance(getGameConfig().hospitals[getServerGame()][i].position, position) < getDistance(getGameConfig().hospitals[getServerGame()][closest].position, position)) {
|
||||
closest = i;
|
||||
}
|
||||
}
|
||||
|
||||
return getGameData().hospitals[getServerGame()][closest];
|
||||
return getGameConfig().hospitals[getServerGame()][closest];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getClosestPoliceStation(position) {
|
||||
let closest = 0;
|
||||
for(let i in getGameData().policeStations[getServerGame()]) {
|
||||
if(getDistance(getGameData().policeStations[getServerGame()][i].position, position) < getDistance(getGameData().policeStations[getServerGame()][closest].position, position)) {
|
||||
for(let i in getGameConfig().policeStations[getServerGame()]) {
|
||||
if(getDistance(getGameConfig().policeStations[getServerGame()][i].position, position) < getDistance(getGameConfig().policeStations[getServerGame()][closest].position, position)) {
|
||||
closest = i;
|
||||
}
|
||||
}
|
||||
|
||||
return getGameData().policeStations[getServerGame()][closest];
|
||||
return getGameConfig().policeStations[getServerGame()][closest];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -190,8 +206,8 @@ function getPlayerIsland(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function isAtPayAndSpray(position) {
|
||||
for(let i in getGameData().payAndSprays[getServerGame()]) {
|
||||
if(getDistance(position, getGameData().payAndSprays[getServerGame()][i]) <= getGlobalConfig().payAndSprayDistance) {
|
||||
for(let i in getGameConfig().payAndSprays[getServerGame()]) {
|
||||
if(getDistance(position, getGameConfig().payAndSprays[getServerGame()][i]) <= getGlobalConfig().payAndSprayDistance) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -431,4 +447,12 @@ function kickAllClients() {
|
||||
})
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updateTimeRule() {
|
||||
if(isTimeSupported()) {
|
||||
server.setRule("Time", makeReadableTime(game.time.hour, game.time.minute));
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user