Merge branch 'nightly'

This commit is contained in:
Vortrex
2022-03-08 10:31:29 -06:00
24 changed files with 497 additions and 531 deletions

View File

@@ -63,8 +63,7 @@ function listAccentsCommand(command, params, client) {
let chunkedList = splitArrayIntoChunks(accentList, 8);
messagePlayerInfo(client, `{clanOrange}== {jobYellow}Accents {clanOrange}==================================`);
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "AccentList")));
for(let i in chunkedList) {
messagePlayerInfo(client, chunkedList[i].join(", "));
}
@@ -112,7 +111,7 @@ function addAccentCommand(command, params, client) {
getGlobalConfig().accents.push(newAccentName);
saveAccentConfig();
messageAdmins(`${client.name} {MAINCOLOUR}added a new accent: ${newAccentName}`);
messageAdmins(`${client.name}{MAINCOLOUR} added a new accent: ${newAccentName}`);
}
// ===========================================================================
@@ -132,7 +131,7 @@ function removeAccentCommand(command, params, client) {
getGlobalConfig().accents.push(newAccentName);
saveAccentConfig();
messageAdmins(`${client.name} {MAINCOLOUR}added a new accent: ${newAccentName}`);
messageAdmins(`${client.name}{MAINCOLOUR} added a new accent: ${newAccentName}`);
}
// ===========================================================================

View File

@@ -599,7 +599,6 @@ function loginSuccess(client) {
getPlayerData(client).accountData.ipAddress = client.ip;
//sendRemovedWorldObjectsToPlayer(client);
sendPlayerChatScrollLines(client, getPlayerData(client).accountData.chatScrollLines);
messagePlayerNormal(null, `👋 ${getPlayerName(client)} has joined the server`, getColourByName("softYellow"));

View File

@@ -9,57 +9,8 @@
function initAntiCheatScript() {
logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Initializing anticheat script ...");
getServerData().antiCheat.whiteListedGameScripts = loadAntiCheatGameScriptWhiteListFromDatabase();
getServerData().antiCheat.blackListedGameScripts = loadAntiCheatGameScriptBlackListFromDatabase();
logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Anticheat script initialized!");
}
// ===========================================================================
function loadAntiCheatGameScriptWhiteListFromDatabase() {
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] Loading whitelisted game scripts ...`);
let dbConnection = connectToDatabase();
let tempWhiteListedGameScripts = [];
if(dbConnection) {
let dbQueryString = `SELECT * FROM ac_script_wl WHERE ac_script_wl_enabled = 1 AND ac_script_wl_server = ${getServerId()}`;
let dbQuery = queryDatabase(dbConnection, dbQueryString);
if(dbQuery) {
if(dbQuery.numRows > 0) {
let dbAssoc = fetchQueryAssoc(dbQuery);
let tempWhiteListedGameScriptData = new WhiteListedGameScriptData(dbAssoc);
tempWhiteListedGameScripts.push(tempWhiteListedGameScriptData);
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] Whitelisted game script '${tempWhiteListedGameScriptData.scriptName}' loaded successfully!`);
}
}
disconnectFromDatabase(dbConnection);
}
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] ${tempWhiteListedGameScripts.length} whitelisted game scripts loaded!`);
return tempWhiteListedGameScripts;
}
// ===========================================================================
function loadAntiCheatGameScriptBlackListFromDatabase() {
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] Loading blacklisted game scripts ...`);
let dbConnection = connectToDatabase();
let tempBlackListedGameScripts = [];
if(dbConnection) {
let dbQueryString = `SELECT * FROM ac_script_bl WHERE ac_script_bl_enabled = 1 AND ac_script_bl_server = ${getServerId()}`;
let dbQuery = queryDatabase(dbConnection, dbQueryString);
if(dbQuery) {
if(dbQuery.numRows > 0) {
let dbAssoc = fetchQueryAssoc(dbQuery);
let tempBlackListedGameScriptData = new BlackListedGameScriptData(dbAssoc);
tempBlackListedGameScripts.push(tempBlackListedGameScriptData);
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] Blacklisted game script '${tempBlackListedGameScriptData.scriptName}' loaded successfully!`);
}
}
disconnectFromDatabase(dbConnection);
}
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] ${tempBlackListedGameScripts.length} blacklisted game scripts loaded!`);
return tempBlackListedGameScripts;
}
// ===========================================================================
@@ -76,170 +27,6 @@ function clearPlayerStateToEnterExitProperty(client) {
// ===========================================================================
/**
* This is a command handler function.
*
* @param {string} command - The command name used by the player
* @param {string} params - The parameters/args string used with the command by the player
* @param {Client} client - The client/player that used the command
* @return {bool} Whether or not the command was successful
*
*/
function addAntiCheatBlackListedScriptCommand(command, params, client) {
if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let scriptName = params;
let tempBlackListedGameScriptData = new BlackListedGameScriptData(false);
tempBlackListedGameScriptData.scriptName = scriptName;
tempBlackListedGameScriptData.serverId = getServerId();
tempBlackListedGameScriptData.enabled = true;
tempBlackListedGameScriptData.needsSaved = true;
getServerConfig().antiCheat.blackListedGameScripts.push(tempBlackListedGameScriptData);
if(getServerConfig().antiCheat.gameScriptBlackListEnabled) {
sendPlayerGameScriptState(null, scriptName, VRR_GAMESCRIPT_DENY);
}
messagePlayerSuccess(client, `You added {ALTCOLOUR}${scriptName} {MAINCOLOUR} to the anticheat game script blacklist`);
return true;
}
// ===========================================================================
/**
* This is a command handler function.
*
* @param {string} command - The command name used by the player
* @param {string} params - The parameters/args string used with the command by the player
* @param {Client} client - The client/player that used the command
* @return {bool} Whether or not the command was successful
*
*/
function addAntiCheatWhiteListedScriptCommand(command, params, client) {
if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let scriptName = params;
let tempWhiteListedGameScriptData = new WhiteListedGameScriptData(false);
tempWhiteListedGameScriptData.scriptName = scriptName;
tempWhiteListedGameScriptData.serverId = getServerId();
tempWhiteListedGameScriptData.enabled = true;
tempWhiteListedGameScriptData.needsSaved = true;
getServerConfig().antiCheat.whiteListedGameScripts.push(tempWhiteListedGameScriptData);
if(getServerConfig().antiCheat.gameScriptWhiteListEnabled) {
sendPlayerGameScriptState(null, scriptName, VRR_GAMESCRIPT_ALLOW);
}
messagePlayerSuccess(client, `You added {ALTCOLOUR}${scriptName} {MAINCOLOUR} to the anticheat game script whitelist`);
return true;
}
// ===========================================================================
/**
* This is a command handler function.
*
* @param {string} command - The command name used by the player
* @param {string} params - The parameters/args string used with the command by the player
* @param {Client} client - The client/player that used the command
* @return {bool} Whether or not the command was successful
*
*/
function removeAntiCheatWhiteListedScriptCommand(command, params, client) {
if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let whiteListScriptId = getAntiCheatWhiteListedScriptFromParams(params);
getServerConfig().antiCheat.whiteListedGameScripts.splice(whiteListScriptId, 1);
if(getServerConfig().antiCheat.gameScriptWhiteListEnabled) {
sendPlayerGameScriptState(null, scriptName, VRR_GAMESCRIPT_NONE);
}
messagePlayerSuccess(client, `You removed {ALTCOLOUR}${scriptName} {MAINCOLOUR} from the anticheat game script whitelist`);
return true;
}
// ===========================================================================
/**
* This is a command handler function.
*
* @param {string} command - The command name used by the player
* @param {string} params - The parameters/args string used with the command by the player
* @param {Client} client - The client/player that used the command
* @return {bool} Whether or not the command was successful
*
*/
function removeAntiCheatBlackListedScriptCommand(command, params, client) {
if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let blackListScriptId = getAntiCheatBlackListedScriptFromParams(params);
getServerConfig().antiCheat.blackListedGameScripts.splice(blackListScriptId, 1);
if(getServerConfig().antiCheat.gameScriptBlackListEnabled) {
sendPlayerGameScriptState(null, scriptName, VRR_GAMESCRIPT_NONE);
}
messagePlayerSuccess(client, `You removed {ALTCOLOUR}${scriptName} {MAINCOLOUR} from the anticheat game script blacklist`);
return true;
}
// ===========================================================================
/**
* This is a command handler function.
*
* @param {string} command - The command name used by the player
* @param {string} params - The parameters/args string used with the command by the player
* @param {Client} client - The client/player that used the command
* @return {bool} Whether or not the command was successful
*
*/
function toggleAntiCheatScriptWhiteListCommand(command, params, client) {
getServerConfig().antiCheat.gameScriptWhiteListEnabled = !getServerConfig().antiCheat.gameScriptWhiteListEnabled;
getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned anticheat game script whitelist ${getBoolRedGreenInlineColour(getServerConfig().antiCheat.gameScriptWhiteListEnabled)}${toUpperCase(getOnOffFromBool(getServerConfig().antiCheat.gameScriptWhiteListEnabled))}`);
updateServerRules();
return true;
}
// ===========================================================================
/**
* This is a command handler function.
*
* @param {string} command - The command name used by the player
* @param {string} params - The parameters/args string used with the command by the player
* @param {Client} client - The client/player that used the command
* @return {bool} Whether or not the command was successful
*
*/
function toggleAntiCheatScriptBlackListCommand(command, params, client) {
getServerConfig().antiCheat.gameScriptBlackListEnabled = !getServerConfig().antiCheat.gameScriptBlackListEnabled;
getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned anticheat game script blacklist ${getBoolRedGreenInlineColour(getServerConfig().antiCheat.gameScriptBlackListEnabled)}${toUpperCase(getOnOffFromBool(getServerConfig().antiCheat.gameScriptBlackListEnabled))}`);
updateServerRules();
return true;
}
// ===========================================================================
function isPlayerExemptFromAntiCheat(client) {
if(hasBitFlag(getPlayerData(client).accountData.flags.moderation, getModerationFlagValue("ExemptFromAntiCheat"))) {
return true;

View File

@@ -58,7 +58,7 @@ function loadBusinessesFromDatabase() {
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempBusinessData = new BusinessData(dbAssoc);
tempBusinessData.locations = loadBusinessLocationsFromDatabase(tempBusinessData.databaseId);
tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId);
//tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId);
tempBusinesses.push(tempBusinessData);
logToConsole(LOG_INFO, `[VRR.Business]: Business '${tempBusinessData.name}' (ID ${tempBusinessData.databaseId}) loaded from database successfully!`);
}
@@ -105,6 +105,7 @@ function loadBusinessLocationsFromDatabase(businessId) {
// ===========================================================================
/*
function loadBusinessGameScriptsFromDatabase(businessId) {
logToConsole(LOG_VERBOSE, `[VRR.Business]: Loading business game scripts for business ${businessId} from database ...`);
@@ -133,6 +134,7 @@ function loadBusinessGameScriptsFromDatabase(businessId) {
logToConsole(LOG_VERBOSE, `[VRR.Business]: ${tempBusinessGameScripts.length} game scripts for business ${businessId} loaded from database successfully!`);
return tempBusinessGameScripts;
}
*/
// ===========================================================================
@@ -1335,11 +1337,7 @@ function createAllBusinessBlips() {
// ===========================================================================
function createBusinessEntrancePickup(businessId) {
if(!areServerElementsSupported()) {
return false;
}
function createBusinessEntrancePickup(businessId) {
if(!getServerConfig().createBusinessPickups) {
return false;
}
@@ -1359,6 +1357,8 @@ function createBusinessEntrancePickup(businessId) {
setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension);
updateBusinessPickupLabelData(businessId);
addToWorld(getBusinessData(businessId).entrancePickup);
} else {
sendBusinessEntranceToPlayer(null, businessId, getBusinessData(businessId), getBusinessData(businessId).entrancePosition, getBusinessData(businessId).entranceBlipModel, getBusinessData(businessId).entrancePickupModel, getBusinessData(businessId).hasInterior, false);
}
}
}
@@ -1388,6 +1388,8 @@ function createBusinessEntranceBlip(businessId) {
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
setElementDimension(getBusinessData(businessId).entranceBlip, getBusinessData(businessId).entranceDimension);
addToWorld(getBusinessData(businessId).entranceBlip);
} else {
sendBusinessEntranceToPlayer(null, businessId, getBusinessData(businessId).name, getBusinessData(businessId).entrancePosition, blipModelId, getBusinessData(businessId).entrancePickupModel, getBusinessData(businessId).hasInterior, false);
}
}
}
@@ -1551,6 +1553,10 @@ function doesBusinessHaveInterior(businessId) {
// ===========================================================================
function deleteBusinessEntrancePickup(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(getBusinessData(businessId).entrancePickup != null) {
//removeFromWorld(getBusinessData(businessId).entrancePickup);
deleteGameElement(getBusinessData(businessId).entrancePickup);
@@ -1561,6 +1567,10 @@ function deleteBusinessEntrancePickup(businessId) {
// ===========================================================================
function deleteBusinessExitPickup(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(getBusinessData(businessId).exitPickup != null) {
//removeFromWorld(getBusinessData(businessId).exitPickup);
deleteGameElement(getBusinessData(businessId).exitPickup);
@@ -1571,6 +1581,10 @@ function deleteBusinessExitPickup(businessId) {
// ===========================================================================
function deleteBusinessEntranceBlip(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(getBusinessData(businessId).entranceBlip != null) {
//removeFromWorld(getBusinessData(businessId).entranceBlip);
deleteGameElement(getBusinessData(businessId).entranceBlip);
@@ -1581,6 +1595,10 @@ function deleteBusinessEntranceBlip(businessId) {
// ===========================================================================
function deleteBusinessExitBlip(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(getBusinessData(businessId).exitBlip != null) {
//removeFromWorld(getBusinessData(businessId).exitBlip);
deleteGameElement(getBusinessData(businessId).exitBlip);
@@ -2042,19 +2060,19 @@ function doesBusinessHaveAnyItemsToBuy(businessId) {
// ===========================================================================
function sendPlayerBusinessGameScripts(client, businessId) {
for(let i in getBusinessData(businessId).gameScripts) {
sendPlayerGameScriptState(client, getBusinessData(businessId).gameScripts[i].state);
}
}
//function sendPlayerBusinessGameScripts(client, businessId) {
// for(let i in getBusinessData(businessId).gameScripts) {
// sendPlayerGameScriptState(client, getBusinessData(businessId).gameScripts[i].state);
// }
//}
// ===========================================================================
function clearPlayerBusinessGameScripts(client, businessId) {
for(let i in getBusinessData(businessId).gameScripts) {
sendPlayerGameScriptState(client, VRR_GAMESCRIPT_DENY);
}
}
//function clearPlayerBusinessGameScripts(client, businessId) {
// for(let i in getBusinessData(businessId).gameScripts) {
// sendPlayerGameScriptState(client, VRR_GAMESCRIPT_DENY);
// }
//}
// ===========================================================================

View File

@@ -62,11 +62,11 @@ class ServerData {
this.antiCheat = {
enabled: false,
checkGameScripts: false,
gameScriptWhiteListEnabled: false,
gameScriptBlackListEnabled: false,
gameScriptWhiteList: [],
gameScriptBlackList: [],
//checkGameScripts: false,
//gameScriptWhiteListEnabled: false,
//gameScriptBlackListEnabled: false,
//gameScriptWhiteList: [],
//gameScriptBlackList: [],
};
this.discordBotToken = "";
@@ -113,38 +113,14 @@ class ServerData {
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 = 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 = hasBitFlag(this.settings, getServerSettingsFlagValue("Logo"));
this.inflationMultiplier = toFloat(dbAssoc["svr_inflation_multiplier"]);
this.testerOnly = hasBitFlag(this.settings, getServerSettingsFlagValue("Testing"));
this.antiCheat = {
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 = hasBitFlag(this.settings, getServerSettingsFlagValue("DiscordBot"));
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 = hasBitFlag(this.settings, getServerSettingsFlagValue("RealTime"));
this.realTimeZone = dbAssoc["svr_time_realtime_timezone"];
this.discordConfig = {
@@ -263,6 +239,8 @@ class ClientData {
this.locale = 0;
this.enteringVehicle = null;
this.pedId = -1;
}
};
@@ -672,7 +650,7 @@ class HouseData {
this.itemCache = [];
this.locations = [];
this.gameScripts = [];
//this.gameScripts = [];
this.entrancePosition = false;
this.entranceRotation = 0.0;

View File

@@ -74,6 +74,7 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("vrr.skinSelected", playerFinishedSkinSelection);
addNetworkEventHandler("vrr.clientInfo", updateConnectionLogOnClientInfoReceive);
addNetworkEventHandler("vrr.vehBuyState", receiveVehiclePurchaseStateUpdateFromClient);
addNetworkEventHandler("vrr.playerPedId", receivePlayerPedNetworkId);
}
// ===========================================================================
@@ -223,29 +224,6 @@ function updatePlayerSnowState(client) {
// ===========================================================================
function sendExcludedModelsForGroundSnowToPlayer(client) {
if(getGameConfig().excludedGroundSnowModels[getServerGame()].length > 0) {
for(let i in getGameConfig().excludedGroundSnowModels[getServerGame()]) {
logToConsole(LOG_DEBUG, `[VRR.Misc] Sending excluded model ${i} for ground snow to ${getPlayerName(client)}`);
sendNetworkEventToPlayer("vrr.excludeGroundSnow", client, getGameConfig().excludedGroundSnowModels[getServerGame()][i]);
}
}
}
// ===========================================================================
function sendRemovedWorldObjectsToPlayer(client) {
if(getGameConfig().removedWorldObjects[getServerGame()].length > 0) {
for(let i in getGameConfig().removedWorldObjects[getServerGame()]) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending removed world object ${i} (${getGameConfig().removedWorldObjects[getServerGame()][i][0]}) to ${getPlayerName(client)}`);
sendNetworkEventToPlayer("vrr.removeWorldObject", client, getGameConfig().removedWorldObjects[getServerGame()][i][0], getGameConfig().removedWorldObjects[getServerGame()][i][1], getGameConfig().removedWorldObjects[getServerGame()][i][2]);
}
}
return true;
}
// ===========================================================================
function updatePlayerHotBar(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
let tempHotBarItems = [];
@@ -1053,12 +1031,6 @@ function setPlayerHeadLookPosition(client, position) {
// ===========================================================================
function sendPlayerGameScriptState(client, scriptName, state) {
sendNetworkEventToPlayer("vrr.gameScript", client, scriptName, state);
}
// ===========================================================================
function requestClientInfo(client) {
sendNetworkEventToPlayer("vrr.clientInfo", client);
}
@@ -1078,7 +1050,10 @@ function forcePlayerToSyncElementProperties(client, element) {
// ===========================================================================
function sendPlayerPedPartsAndProps(client) {
sendNetworkEventToPlayer("vrr.ped")
let bodyParts = getPlayerCurrentSubAccount(client).bodyParts;
let bodyProps = getPlayerCurrentSubAccount(client).bodyProps;
sendNetworkEventToPlayer("vrr.ped", client, [bodyParts.hair, bodyParts.head, bodyParts.upper, bodyParts.lower], [bodyProps.hair, bodyProps.eyes, bodyProps.head, bodyProps.leftHand, bodyProps.rightHand, bodyProps.leftWrist, bodyProps.rightWrist, bodyParts.hip, bodyProps.leftFoot, bodyProps.rightFoot]);
}
// ===========================================================================
@@ -1146,4 +1121,44 @@ function sendHouseEntranceToPlayer(client, houseId, entrancePosition, blipModel,
sendNetworkEventToPlayer("vrr.house", client, houseId, entrancePosition, blipModel, pickupModel, hasInterior);
}
// ==========================================================================
function sendAllBusinessEntrancesToPlayer(client) {
let businesses = getServerData().businesses;
for(let i in businesses) {
if(businesses[i].entranceBlipModel > 0) {
sendBusinessEntranceToPlayer(client, businesses[i].index, businesses[i].name, businesses[i].entrancePosition, businesses[i].entranceBlipModel, businesses[i].entrancePickupModel, businesses[i].hasInterior, false);
}
}
}
// ==========================================================================
function sendAllHouseEntrancesToPlayer(client) {
let houses = getServerData().houses;
for(let i in houses) {
if(houses[i].entranceBlipModel > 0) {
sendBusinessEntranceToPlayer(client, businesses[i].index, houses[i].entrancePosition, houses[i].entranceBlipModel, houses[i].entrancePickupModel, houses[i].hasInterior);
}
}
}
// ==========================================================================
function makePlayerHoldObjectModel(client, modelIndex) {
sendNetworkEventToPlayer("vrr.holdObject", client, getPlayerData(client).pedId, modelIndex);
}
// ==========================================================================
function receivePlayerPedNetworkId(client, pedId) {
getPlayerData(client).pedId = pedId;
}
// ==========================================================================
function requestPlayerPedNetworkId(client) {
sendNetworkEventToPlayer("vrr.playerPedId", client);
}
// ==========================================================================

View File

@@ -68,12 +68,6 @@ function loadCommands() {
commandData("stopanim", stopPlayerAnimationCommand, "", getStaffFlagValue("None"), true, true, "Stops your current animation"),
],
antiCheat: [
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),
],

View File

@@ -131,6 +131,22 @@ function loadServerConfigFromId(tempServerId) {
if(dbQuery.numRows > 0) {
let dbAssoc = fetchQueryAssoc(dbQuery);
let tempServerConfigData = new ServerData(dbAssoc);
tempServerConfigData.fallingSnow = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("FallingSnow"));
tempServerConfigData.groundSnow = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("GroundSnow"));
tempServerConfigData.useGUI = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("GUI"));
tempServerConfigData.showLogo = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("Logo"));
tempServerConfigData.testerOnly = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("Testing"));
tempServerConfigData.discordEnabled = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("DiscordBot"));
tempServerConfigData.createJobPickups = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("JobPickups"));
tempServerConfigData.createBusinessPickups = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("BusinessPickups"));
tempServerConfigData.createHousePickups = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("HousePickups"));
tempServerConfigData.createJobBlips = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("JobBlips"));
tempServerConfigData.createBusinessBlips = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("BusinessBlips"));
tempServerConfigData.createHouseBlips = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("HouseBlips"));
tempServerConfigData.useRealTime = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("RealTime"));
tempServerConfigData.antiCheat.enabled = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("Anticheat"));
freeDatabaseQuery(dbQuery);
return tempServerConfigData;
}

View File

@@ -9,7 +9,7 @@
let scriptVersion = "1.0";
let serverStartTime = 0;
let logLevel = LOG_DEBUG;
let logLevel = LOG_INFO;
// ===========================================================================
@@ -25,8 +25,8 @@ let serverData = {
itemTypes: [],
clans: [],
antiCheat: {
whiteListedGameScripts: [],
blackListedGameScripts: [],
//whiteListedGameScripts: [],
//blackListedGameScripts: [],
},
localeStrings: {},
cachedTranslations: [],

View File

@@ -596,6 +596,14 @@ function onPlayerSpawn(client) {
logToConsole(LOG_DEBUG, `[VRR.Event] Updating all player name tags`);
updateAllPlayerNameTags();
if(!areServerElementsSupported()) {
sendAllBusinessEntrancesToPlayer(client);
sendAllHouseEntrancesToPlayer(client);
//sendAllJobLocationsToPlayer(client);
}
requestPlayerPedNetworkId(client);
getPlayerData(client).payDayTickStart = sdl.ticks;
//}
}

View File

@@ -1140,6 +1140,10 @@ function doesHouseHaveInterior(houseId) {
// ===========================================================================
function deleteHouseEntrancePickup(houseId) {
if(!areServerElementsSupported()) {
return false;
}
if(getHouseData(houseId).entrancePickup != null) {
//removeFromWorld(getHouseData(houseId).entrancePickup);
deleteGameElement(getHouseData(houseId).entrancePickup);
@@ -1150,6 +1154,10 @@ function deleteHouseEntrancePickup(houseId) {
// ===========================================================================
function deleteHouseExitPickup(houseId) {
if(!areServerElementsSupported()) {
return false;
}
if(getHouseData(houseId).exitPickup != null) {
//removeFromWorld(getHouseData(houseId).exitPickup);
deleteGameElement(getHouseData(houseId).exitPickup);
@@ -1160,6 +1168,10 @@ function deleteHouseExitPickup(houseId) {
// ===========================================================================
function deleteHouseEntranceBlip(houseId) {
if(!areServerElementsSupported()) {
return false;
}
if(getHouseData(houseId).entranceBlip != null) {
//removeFromWorld(getHouseData(houseId).entranceBlip);
deleteGameElement(getHouseData(houseId).entranceBlip);
@@ -1170,6 +1182,10 @@ function deleteHouseEntranceBlip(houseId) {
// ===========================================================================
function deleteHouseExitBlip(houseId) {
if(!areServerElementsSupported()) {
return false;
}
if(getHouseData(houseId).exitBlip != null) {
//removeFromWorld(getHouseData(houseId).exitBlip);
deleteGameElement(getHouseData(houseId).exitBlip);
@@ -1265,19 +1281,19 @@ function getHouseIdFromDatabaseId(databaseId) {
// ===========================================================================
function sendPlayerHouseGameScripts(client, houseId) {
for(let i in getHouseData(houseId).gameScripts) {
sendPlayerGameScriptState(client, getHouseData(houseId).gameScripts[i].state);
}
}
//function sendPlayerHouseGameScripts(client, houseId) {
// for(let i in getHouseData(houseId).gameScripts) {
// sendPlayerGameScriptState(client, getHouseData(houseId).gameScripts[i].state);
// }
//}
// ===========================================================================
function clearPlayerHouseGameScripts(client, houseId) {
for(let i in getHouseData(houseId).gameScripts) {
sendPlayerGameScriptState(client, VRR_GAMESCRIPT_DENY);
}
}
//function clearPlayerHouseGameScripts(client, houseId) {
// for(let i in getHouseData(houseId).gameScripts) {
// sendPlayerGameScriptState(client, VRR_GAMESCRIPT_DENY);
// }
//}
// ===========================================================================

View File

@@ -481,6 +481,11 @@ function isPlayerCreatingCharacter(client) {
// ===========================================================================
/**
*
* @return {SubAccountData} - The player's current subaccount/character data
*
*/
function getPlayerCurrentSubAccount(client) {
if(!getPlayerData(client)) {
return false;

View File

@@ -128,14 +128,16 @@ function vehicleRentCheck() {
// Loop through players, not vehicles. Much more efficient (and doesn't consume resources when no players are connected)
let clients = getClients();
for(let i in clients) {
if(getPlayerData(clients[i]) != false) {
if(isPlayerLoggedIn(clients[i] && isPlayerSpawned(clients[i]))) {
if(getPlayerData(clients[i]).rentingVehicle != false) {
if(getPlayerCurrentSubAccount(clients[i]).cash < getServerData().vehicles[getPlayerData(clients[i]).rentingVehicle].rentPrice) {
messagePlayerAlert(clients[i], `You do not have enough money to continue renting this vehicle!`);
stopRentingVehicle(clients[i]);
} else {
takePlayerCash(clients[i], getServerData().vehicles[getPlayerData(clients[i]).rentingVehicle].rentPrice);
if(isClientInitialized(clients[i])) {
if(getPlayerData(clients[i]) != false) {
if(isPlayerLoggedIn(clients[i] && isPlayerSpawned(clients[i]))) {
if(getPlayerData(clients[i]).rentingVehicle != false) {
if(getPlayerCurrentSubAccount(clients[i]).cash < getServerData().vehicles[getPlayerData(clients[i]).rentingVehicle].rentPrice) {
messagePlayerAlert(clients[i], `You do not have enough money to continue renting this vehicle!`);
stopRentingVehicle(clients[i]);
} else {
takePlayerCash(clients[i], getServerData().vehicles[getPlayerData(clients[i]).rentingVehicle].rentPrice);
}
}
}
}
@@ -168,10 +170,12 @@ function vehicleRentCheck() {
function updatePings() {
let clients = getClients();
for(let i in clients) {
if(!clients[i].console) {
updatePlayerPing(clients[i]);
if(isPlayerSpawned(clients[i])) {
updatePlayerCash(clients[i]);
if(isClientInitialized(clients[i])) {
if(!clients[i].console) {
updatePlayerPing(clients[i]);
if(isPlayerSpawned(clients[i])) {
updatePlayerCash(clients[i]);
}
}
}
}
@@ -205,14 +209,16 @@ function checkServerGameTime() {
function checkPayDays() {
let clients = getClients();
for(let i in clients) {
if(isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
getPlayerData(clients[i]).payDayStart = sdl.ticks;
playerPayDay(clients[i]);
if(isClientInitialized(clients[i])) {
if(isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
getPlayerData(clients[i]).payDayStart = sdl.ticks;
playerPayDay(clients[i]);
//if(sdl.ticks-getPlayerData(clients[i]).payDayTickStart >= getGlobalConfig().payDayTickCount) {
// getPlayerData(clients[i]).payDayStart = sdl.ticks;
// playerPayDay(clients[i]);
//}
//if(sdl.ticks-getPlayerData(clients[i]).payDayTickStart >= getGlobalConfig().payDayTickCount) {
// getPlayerData(clients[i]).payDayStart = sdl.ticks;
// playerPayDay(clients[i]);
//}
}
}
}
@@ -230,9 +236,11 @@ function showRandomTipToAllPlayers() {
let clients = getClients();
for(let i in clients) {
if(isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
if(!doesPlayerHaveRandomTipsDisabled(clients[i])) {
messagePlayerTimedRandomTip(null, randomTips[tipId]);
if(isClientInitialized(clients[i])) {
if(isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
if(!doesPlayerHaveRandomTipsDisabled(clients[i])) {
messagePlayerTimedRandomTip(null, randomTips[tipId]);
}
}
}
}

View File

@@ -63,7 +63,9 @@ function getGameAreas(gameId) {
*/
function getPlayerData(client) {
if(client != null) {
return getServerData().clients[client.index];
if(isClientInitialized(client)) {
return getServerData().clients[client.index];
}
}
return false;
}
@@ -455,4 +457,10 @@ function updateTimeRule() {
}
}
// ===========================================================================
function isClientInitialized(client) {
return (typeof getServerData().clients[client.index] != "undefined");
}
// ===========================================================================