From db0405f48a4e898ce58f29a71fb6642c4f966c88 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Thu, 20 May 2021 16:34:42 -0500 Subject: [PATCH] Changes --- scripts/server/accent.js | 12 +++ scripts/server/class.js | 97 ++++++++++++++++++++++- scripts/server/command.js | 149 +++++++++++++++++++++-------------- scripts/server/help.js | 71 ++++++++++++++--- scripts/server/moderation.js | 86 ++++++++++++++++++++ scripts/server/utilities.js | 4 +- 6 files changed, 343 insertions(+), 76 deletions(-) diff --git a/scripts/server/accent.js b/scripts/server/accent.js index 4e60288f..27e2f89e 100644 --- a/scripts/server/accent.js +++ b/scripts/server/accent.js @@ -12,4 +12,16 @@ function getPlayerAccentText(client) { return getPlayerCurrentSubAccount(client).accent; } +// =========================================================================== + +function setPlayerAccentText(client, text) { + getPlayerCurrentSubAccount(client).accent = text; +} + +// =========================================================================== + +function doesPlayerHaveAccent(client, text) { + return (getPlayerCurrentSubAccount(client).accent != ""); +} + // =========================================================================== \ No newline at end of file diff --git a/scripts/server/class.js b/scripts/server/class.js index 3fe1a953..dce92c43 100644 --- a/scripts/server/class.js +++ b/scripts/server/class.js @@ -22,6 +22,7 @@ function initClassScript() { function initClassTable() { let tempClasses = { + /** @class serverConfigData Representing server configuration loaded/saved in database */ serverConfigData: class { constructor(dbAssoc) { this.databaseId = 0; @@ -132,6 +133,8 @@ function initClassTable() { } } }, + + /** @class clientData Representing extra data for a client */ clientData: class { constructor(client, accountData, subAccounts) { this.accountData = accountData; @@ -208,6 +211,8 @@ function initClassTable() { this.returnToDimension = null; } }, + + /** @class clientData Representing an account, loaded/saved in the database */ accountData: class { constructor(dbAssoc) { this.databaseId = 0; @@ -267,6 +272,7 @@ function initClassTable() { } } }, + /** @class accountContactData Representing an account's contact list, loaded/saved in the database */ accountContactData: class { constructor(dbAssoc) { this.databaseId = 0; @@ -285,6 +291,7 @@ function initClassTable() { } } }, + /** @class accountMessageData Representing an account's messages, loaded/saved in the database */ accountMessageData: class { constructor(dbAssoc) { this.databaseId = 0; @@ -311,6 +318,7 @@ function initClassTable() { } } }, + /** @class accountStaffNoteData Representing an account's staff notes. Visible only to staff and loaded/saved in the database */ accountStaffNoteData: class { constructor(dbAssoc) { this.databaseId = 0; @@ -335,6 +343,7 @@ function initClassTable() { } } }, + /** @class subAccountData Representing a character's (subaccount) data. Loaded and saved in the database */ subAccountData: class { constructor(dbAssoc) { this.databaseId = 0; @@ -437,6 +446,7 @@ function initClassTable() { } } }, + /** @class businessData Representing a businesses' data. Loaded and saved in the database */ businessData: class { constructor(dbAssoc) { this.databaseId = 0; @@ -500,6 +510,7 @@ function initClassTable() { } } }, + /** @class businessLocationData Representing a business's location data. Multiple can be used for a single business. Used for things like doors, fuel pumps, drive thru positions, etc. Loaded and saved in the database */ businessLocationData: class { constructor(dbAssoc) { this.databaseId = 0; @@ -528,6 +539,7 @@ function initClassTable() { } } }, + /** @class houseData Representing a house's data. Loaded and saved in the database */ houseData: class { constructor(dbAssoc) { this.databaseId = 0 @@ -588,6 +600,36 @@ function initClassTable() { } } }, + /** @class houseLocationData Representing a houses's location data. Multiple can be used for a single house. Used for things like doors, garage entry/exit/vehspawn, gates, etc. Loaded and saved in the database */ + houseLocationData: class { + constructor(dbAssoc) { + this.databaseId = 0; + this.name = ""; + this.type = 0; + this.house = 0; + this.enabled = false; + this.index = -1; + this.needsSaved = false; + + this.position = toVector3(0.0, 0.0, 0.0); + this.interior = 0; + this.dimension = 0; + + if(dbAssoc) { + this.databaseId = toInteger(dbAssoc("house_loc_id")); + this.name = toString(dbAssoc("house_loc_name")); + this.type = toInteger(dbAssoc("house_loc_type")); + this.house = toInteger(dbAssoc("house_loc_house")); + this.enabled = intToBool(toInteger(dbAssoc("house_loc_enabled"))); + this.index = -1; + + this.position = toVector3(toFloat(dbAssoc["house_loc_pos_x"]), toFloat(dbAssoc["house_loc_pos_y"]), toFloat(dbAssoc["house_loc_pos_z"])); + this.interior = toInteger(dbAssoc["house_loc_int"]); + this.dimension = toInteger(dbAssoc["house_loc_vw"]); + } + } + }, + /** @class clanData Representing a clan's data. Loaded and saved in the database */ clanData: class { constructor(dbAssoc) { this.databaseId = 0; @@ -612,6 +654,7 @@ function initClassTable() { } } }, + /** @class clanRankData Representing a clan rank's data. Loaded and saved in the database */ clanRankData: class { constructor(dbAssoc) { this.databaseId = 0; @@ -637,6 +680,7 @@ function initClassTable() { } } }, + /** @class clanMemberData Representing a clan member's data. Loaded and saved in the database */ clanMemberData: class { constructor(dbAssoc) { this.databaseId = 0; @@ -664,6 +708,7 @@ function initClassTable() { } } }, + /** @class vehicleData Representing a vehicle's data. Loaded and saved in the database */ vehicleData: class { constructor(dbAssoc = false, vehicle = false) { // General Info @@ -798,6 +843,7 @@ function initClassTable() { this.streamingRadioStation = -1; } }, + /** @class commandData Representing a command's data. Loaded and saved in the database */ commandData: class { enable() { this.enabled = true; @@ -811,16 +857,19 @@ function initClassTable() { this.enabled = !this.enabled; } - constructor(command, handlerFunction, syntaxString, requiredStaffFlags, requireLogin, allowOnDiscord) { + constructor(command, handlerFunction, syntaxString, requiredStaffFlags, requireLogin, allowOnDiscord, helpDescription) { this.command = command; this.handlerFunction = handlerFunction; this.syntaxString = syntaxString; this.requiredStaffFlags = requiredStaffFlags; this.enabled = true; this.requireLogin = requireLogin; - this.allowOnDiscord = allowOnDiscord + this.allowOnDiscord = allowOnDiscord; + this.helpDescription = helpDescription; + this.aliases = []; } }, + /** @class crimeData Representing a crime's data. Loaded and saved in the database */ crimeData: class { constructor(suspectId, crimeType, reporterId = 0) { this.crimeType = crimeType; @@ -831,6 +880,7 @@ function initClassTable() { this.databaseId = 0; } }, + /** @class jobData Representing a job's data. Loaded and saved in the database */ jobData: class { constructor(dbAssoc = false) { this.databaseId = 0; @@ -872,6 +922,7 @@ function initClassTable() { } } }, + /** @class jobEquipmentData Representing a job equipment set's data. Loaded and saved in the database */ jobEquipmentData: class { constructor(dbAssoc = false) { this.databaseId = 0; @@ -893,6 +944,7 @@ function initClassTable() { } } }, + /** @class jobEquipmentItemData Representing a job equipment set item's data. Loaded and saved in the database */ jobEquipmentItemData: class { constructor(dbAssoc = false) { this.databaseId = 0; @@ -913,6 +965,7 @@ function initClassTable() { } } }, + /** @class jobUniformData Representing a job uniform's data. Loaded and saved in the database */ jobUniformData: class { constructor(dbAssoc = false) { this.databaseId = 0; @@ -925,6 +978,26 @@ function initClassTable() { this.jobIndex = -1; this.needsSaved = false; + this.bodyParts = { + hair: [0,0], + head: [0,0], + upper: [0,0], + lower: [0,0], + }; + + this.bodyProps = { + hair: [0,0], + eyes: [0,0], + head: [0,0], + leftHand: [0,0], + rightHand: [0,0], + leftWrist: [0,0], + rightWrist: [0,0], + hip: [0,0], + leftFoot: [0,0], + rightFoot: [0,0], + }; + if(dbAssoc) { this.databaseId = dbAssoc["job_uniform_id"]; this.job = dbAssoc["job_uniform_job"]; @@ -932,6 +1005,26 @@ function initClassTable() { this.requiredRank = dbAssoc["job_uniform_minrank"]; this.skin = dbAssoc["job_uniform_skin"]; this.enabled = intToBool(dbAssoc["job_uniform_enabled"]); + + this.bodyParts = { + hair: [toInteger(dbAssoc["job_uniform_hd_part_hair_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_part_hair_texture"]) || 0], + head: [toInteger(dbAssoc["job_uniform_hd_part_head_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_part_head_texture"]) || 0], + upper: [toInteger(dbAssoc["job_uniform_hd_part_upper_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_part_upper_texture"]) || 0], + lower: [toInteger(dbAssoc["job_uniform_hd_part_lower_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_part_lower_texture"]) || 0], + }; + + this.bodyProps = { + hair: [toInteger(dbAssoc["job_uniform_hd_prop_hair_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_hair_texture"]) || 0], + eyes: [toInteger(dbAssoc["job_uniform_hd_prop_eyes_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_eyes_texture"]) || 0], + head: [toInteger(dbAssoc["job_uniform_hd_prop_head_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_head_texture"]) || 0], + leftHand: [toInteger(dbAssoc["job_uniform_hd_prop_lefthand_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_lefthand_texture"]) || 0], + rightHand: [toInteger(dbAssoc["job_uniform_hd_prop_righthand_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_righthand_texture"]) || 0], + leftWrist: [toInteger(dbAssoc["job_uniform_hd_prop_leftwrist_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_leftwrist_texture"]) || 0], + rightWrist: [toInteger(dbAssoc["job_uniform_hd_prop_rightwrist_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_rightwrist_texture"]) || 0], + hip: [toInteger(dbAssoc["job_uniform_hd_prop_hip_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_hip_texture"]) || 0], + leftFoot: [toInteger(dbAssoc["job_uniform_hd_prop_leftfoot_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_leftfoot_texture"]) || 0], + rightFoot: [toInteger(dbAssoc["job_uniform_hd_prop_rightfoot_model"]) || 0, toInteger(dbAssoc["job_uniform_hd_prop_rightfoot_texture"]) || 0], + }; } } }, diff --git a/scripts/server/command.js b/scripts/server/command.js index 6ddd57c3..52b2ec6f 100644 --- a/scripts/server/command.js +++ b/scripts/server/command.js @@ -62,11 +62,11 @@ function loadCommands() { //commandData("ac", getGlobalAntiCheatStatusCommand, "<0/1 state>", getStaffFlagValue("developer"), true, true), ], ban: [ - commandData("aban", accountBanCommand, " ", getStaffFlagValue("manageBans"), true, true, "Bans a player's account."), - commandData("cban", subAccountBanCommand, " ", getStaffFlagValue("manageBans"), true, true, "Bans a player's character."), - commandData("saban", subAccountBanCommand, " ", getStaffFlagValue("manageBans"), true, true, "Bans a player's character (subaccount)."), - commandData("ipban", ipBanCommand, " ", getStaffFlagValue("manageBans"), true, true, "Bans a player's IP."), - commandData("subnetban", subNetBanCommand, " ", getStaffFlagValue("manageBans"), true, true, "Bans a player's subnet."), + commandData("aban", accountBanCommand, " ", getStaffFlagValue("basicModeration"), true, true, "Bans a player's account."), + commandData("cban", subAccountBanCommand, " ", getStaffFlagValue("basicModeration"), true, true, "Bans a player's character."), + commandData("saban", subAccountBanCommand, " ", getStaffFlagValue("basicModeration"), true, true, "Bans a player's character (subaccount)."), + commandData("ipban", ipBanCommand, " ", getStaffFlagValue("basicModeration"), true, true, "Bans a player's IP."), + commandData("subnetban", subNetBanCommand, " ", getStaffFlagValue("basicModeration"), true, true, "Bans a player's subnet."), ], bitFlag: [], business: [ @@ -102,36 +102,36 @@ function loadCommands() { commandData("bizdelstorageitems", deleteBusinessStorageItemsCommand, "", getStaffFlagValue("manageItems"), true, true, "Destroys all items in the business's storage"), ], chat: [ - commandData("me", meActionCommand, "", getStaffFlagValue("none"), true, false), - commandData("do", doActionCommand, "", getStaffFlagValue("none"), true, false), - commandData("s", shoutCommand, "", getStaffFlagValue("none"), true, false), - commandData("shout", shoutCommand, "", getStaffFlagValue("none"), true, false), - commandData("talk", talkCommand, "", getStaffFlagValue("none"), true, false), - commandData("local", talkCommand, "", getStaffFlagValue("none"), true, false), - commandData("l", talkCommand, "", getStaffFlagValue("none"), true, false), - commandData("w", whisperCommand, "", getStaffFlagValue("none"), true, false), - commandData("whisper", whisperCommand, "", getStaffFlagValue("none"), true, false), - commandData("clanchat", clanChatCommand, "", getStaffFlagValue("none"), true, false), - commandData("clan", clanChatCommand, "", getStaffFlagValue("none"), true, false), - commandData("c", clanChatCommand, "", getStaffFlagValue("none"), true, false), - commandData("adminchat", adminChatCommand, "", getStaffFlagValue("basicModeration"), true, true), - commandData("a", adminChatCommand, "", getStaffFlagValue("basicModeration"), true, true), - commandData("achat", adminChatCommand, "", getStaffFlagValue("basicModeration"), true, true), + commandData("me", meActionCommand, "", getStaffFlagValue("none"), true, false, "Shows a custom action message in chat"), + commandData("do", doActionCommand, "", getStaffFlagValue("none"), true, false, "Shows a custom action description in chat"), + commandData("s", shoutCommand, "", getStaffFlagValue("none"), true, false, "Shout a message to others in the area"), + commandData("shout", shoutCommand, "", getStaffFlagValue("none"), true, false, "Shout a message to others in the area"), + commandData("talk", talkCommand, "", getStaffFlagValue("none"), true, false, "Say a message to others nearby"), + commandData("local", talkCommand, "", getStaffFlagValue("none"), true, false, "Say a message to others nearby"), + commandData("l", talkCommand, "", getStaffFlagValue("none"), true, false, "Say a message to others nearby"), + commandData("w", whisperCommand, "", getStaffFlagValue("none"), true, false, "Whisper a message to players very close to you"), + commandData("whisper", whisperCommand, "", getStaffFlagValue("none"), true, false, "Whisper a message to players very close to you"), + commandData("clanchat", clanChatCommand, "", getStaffFlagValue("none"), true, false, "Sends an OOC chat message to members in your clan"), + commandData("clan", clanChatCommand, "", getStaffFlagValue("none"), true, false, "Sends an OOC chat message to members in your clan"), + commandData("c", clanChatCommand, "", getStaffFlagValue("none"), true, false, "Sends an OOC chat message to members in your clan"), + commandData("adminchat", adminChatCommand, "", getStaffFlagValue("basicModeration"), true, true, "Sends an OOC chat message to other admins"), + commandData("a", adminChatCommand, "", getStaffFlagValue("basicModeration"), true, true, "Sends an OOC chat message to other admins"), + commandData("achat", adminChatCommand, "", getStaffFlagValue("basicModeration"), true, true, "Sends an OOC chat message to other admins"), ], clan: [ - commandData("addclan", createClanCommand, "", getStaffFlagValue("manageClans"), true, true), - commandData("delclan", deleteClanCommand, "", getStaffFlagValue("manageClans"), true, true), + commandData("addclan", createClanCommand, "", getStaffFlagValue("manageClans"), true, true, "Creates an new empty, unowned clan."), + commandData("delclan", deleteClanCommand, "", getStaffFlagValue("manageClans"), true, true, "Deletes a clan by ID or name"), - commandData("clanowner", setClanOwnerCommand, " ", getStaffFlagValue("none"), true, true), - commandData("clantag", setClanTagCommand, "", getStaffFlagValue("none"), true, true), - commandData("clanranktag", setClanRankTagCommand, " ", getStaffFlagValue("none"), true, true), - commandData("clanmembertag", setClanMemberTagCommand, " ", getStaffFlagValue("none"), true, true), - commandData("clanranktitle", setClanRankTitleCommand, " ", getStaffFlagValue("none"), true, true), - commandData("clanmembertitle", setClanMemberTitleCommand, "<player name/id> <title>", getStaffFlagValue("none"), true, true), - commandData("addclanrankflag", addClanRankFlagCommand, "<rank name/id> <flag name>", getStaffFlagValue("none"), true, true), - commandData("delclanrankflag", removeClanRankFlagCommand, "<rank name/id> <flag name>", getStaffFlagValue("none"), true, true), - commandData("addclanmemberflag", addClanMemberFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("none"), true, true), - commandData("delclanmemberflag", removeClanMemberFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("none"), true, true), + commandData("clanowner", setClanOwnerCommand, "<clan id> <player name/id>", getStaffFlagValue("none"), true, true, "Gives ownership of the clan to a player"), + commandData("clantag", setClanTagCommand, "<tag>", getStaffFlagValue("none"), true, true, "Sets a clan's main tag"), + commandData("clanranktag", setClanRankTagCommand, "<rank id> <tag>", getStaffFlagValue("none"), true, true, "Sets a clan rank's custom tag"), + commandData("clanmembertag", setClanMemberTagCommand, "<player name/id> <tag>", getStaffFlagValue("none"), true, true, "Sets a clan members's custom tag"), + commandData("clanranktitle", setClanRankTitleCommand, "<rank id> <title>", getStaffFlagValue("none"), true, true, "Sets a clan rank's title"), + commandData("clanmembertitle", setClanMemberTitleCommand, "<player name/id> <title>", getStaffFlagValue("none"), true, true, "Sets a clan members's custom title"), + commandData("addclanrankflag", addClanRankFlagCommand, "<rank name/id> <flag name>", getStaffFlagValue("none"), true, true, "Gives a clan rank a clan permission."), + commandData("delclanrankflag", removeClanRankFlagCommand, "<rank name/id> <flag name>", getStaffFlagValue("none"), true, true, "Takes a clan permission from a clan rank"), + commandData("addclanmemberflag", addClanMemberFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("none"), true, true, "Gives a clan member a clan permission"), + commandData("delclanmemberflag", removeClanMemberFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("none"), true, true, "Takes a clan permission from a clan member"), ], class: [], client: [], @@ -228,8 +228,6 @@ function loadCommands() { commandData("itemuseval", setItemTypeUseValueCommand, "<item type> <use value>", getStaffFlagValue("manageItems"), true, false), commandData("itemorderprice", setItemTypeOrderPriceCommand, "<item type> <price>", getStaffFlagValue("manageItems"), true, false), commandData("itemriskmult", setItemTypeRiskMultiplierCommand, "<item type> <risk multiplier>", getStaffFlagValue("manageItems"), true, false), - - ], job: [ commandData("takejob", takeJobCommand, "", getStaffFlagValue("none"), true, false), @@ -291,35 +289,38 @@ function loadCommands() { commandData("radiovolume", setStreamingRadioVolumeCommand, "<volume level>", getStaffFlagValue("none"), true, false), ], moderation: [ - commandData("kick", kickClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true), - commandData("mute", muteClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true), - commandData("freeze", freezeClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true), - commandData("unmute", unMuteClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true), - commandData("unfreeze", unFreezeClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true), - commandData("goto", gotoPlayerCommand, "<player name/id>", getStaffFlagValue("basicModeration"), true, true), - commandData("gethere", getPlayerCommand, "<player name/id>", getStaffFlagValue("basicModeration"), true, true), - commandData("gotopos", gotoPositionCommand, "<x> <y> <z> [int] [vw]", getStaffFlagValue("basicModeration"), true, true), - commandData("gotoveh", gotoVehicleCommand, "<vehicle id>", getStaffFlagValue("basicModeration"), true, true), - commandData("gotobiz", gotoBusinessCommand, "<business id/name>", getStaffFlagValue("basicModeration"), true, true), - commandData("gotohouse", gotoHouseCommand, "<house id/name>", getStaffFlagValue("basicModeration"), true, true), - commandData("gotojob", gotoJobLocationCommand, "<job id/name> <location id>", getStaffFlagValue("basicModeration"), true, true), - commandData("gotoloc", gotoGameLocationCommand, "<location name>", getStaffFlagValue("basicModeration"), true, true), - commandData("fr", teleportForwardCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true), - commandData("ba", teleportBackwardCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true), - commandData("lt", teleportLeftCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true), - commandData("rt", teleportRightCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true), - commandData("up", teleportUpCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true), - commandData("dn", teleportDownCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true), - commandData("int", playerInteriorCommand, "<interior id>", getStaffFlagValue("basicModeration"), true, true), - commandData("vw", playerVirtualWorldCommand, "<virtual world id>", getStaffFlagValue("basicModeration"), true, true), + commandData("kick", kickClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true, "Kicks a player from the server"), + commandData("mute", muteClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true, "Mutes a player, preventing them from using any chat."), + commandData("freeze", freezeClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true, "Freeze a player, preventing them from moving."), + commandData("unmute", unMuteClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true, "Unmutes a player, allowing them to chat again."), + commandData("unfreeze", unFreezeClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true, "Unfreezes a player, allowing them to move again."), + commandData("goto", gotoPlayerCommand, "<player name/id>", getStaffFlagValue("basicModeration"), true, true, "Teleports you to a player."), + commandData("gethere", getPlayerCommand, "<player name/id>", getStaffFlagValue("basicModeration"), true, true, "Teleports a player to you."), + commandData("gotopos", gotoPositionCommand, "<x> <y> <z> [int] [vw]", getStaffFlagValue("basicModeration"), true, true, "Teleports you to specific coordinates with optional interior and dimension."), + commandData("gotoveh", gotoVehicleCommand, "<vehicle id>", getStaffFlagValue("basicModeration"), true, true, "Teleports you to a vehicle by ID."), + commandData("gotobiz", gotoBusinessCommand, "<business id/name>", getStaffFlagValue("basicModeration"), true, true, "Teleports you to a business by ID or name."), + commandData("gotohouse", gotoHouseCommand, "<house id/name>", getStaffFlagValue("basicModeration"), true, true, "Teleports you to a house by ID or description."), + 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("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("addstaffflag", addStaffFlagCommand, "<player name/id> [flag name]", getStaffFlagValue("manageAdmins"), true, true), - commandData("delstaffflag", takeStaffFlagCommand, "<player name/id> [flag name]", getStaffFlagValue("manageAdmins"), true, true), - commandData("getstaffflags", getStaffFlagsCommand, "<player name/id>", getStaffFlagValue("manageAdmins"), true, true), - commandData("clearstaffflags", clearStaffFlagsCommand, "<player name/id>", getStaffFlagValue("manageAdmins"), true, true), - commandData("staffflags", allStaffFlagsCommand, "", getStaffFlagValue("manageAdmins"), true, true), + commandData("addstaffflag", addStaffFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("manageAdmins"), true, true, "Gives a player a staff flaf (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)."), + commandData("clearstaffflags", clearStaffFlagsCommand, "<player name/id>", getStaffFlagValue("manageAdmins"), true, true, "Removes all staff flags for a player (this server only)."), + commandData("staffflags", allStaffFlagsCommand, "", getStaffFlagValue("manageAdmins"), true, true, "Shows a list of all valid staff flag names."), commandData("givemoney", givePlayerMoneyCommand, "<player name/id> <amount>", getStaffFlagValue("serverManager"), true, true), + + commandData("nonrpname", forceCharacterNameChangeCommand, "<player name/id>", getStaffFlagValue("basicModeration"), true, true, "Forces a player to change their current character's name."), + commandData("forcename", forceCharacterNameCommand, "<player name/id> <first name> <last name>", getStaffFlagValue("basicModeration"), true, true, "Changes a character's name directly."), ], security: [], startup: [], @@ -626,4 +627,32 @@ function doesCommandExist(command) { return false; } +// =========================================================================== + +function cacheAllCommandsAliases() { + for(let i in serverCommands) { + for(let j in serverCommands[i]) { + for(let k in serverCommands) { + for(let m in serverCommands[k]) { + if(serverCommands[i][j].handlerFunction == serverCommands[k][m].handlerFunction) { + serverCommands[i][j].aliases.push(serverCommands[k][m]); + serverCommands[k][m].aliases.push(serverCommands[i][j]); + } + } + } + } + } +} + +// =========================================================================== + +function getCommandAliasesNames(command) { + let commandAliases = []; + for(let i in command.aliases) { + commandAliases.push(command.aliases[i].name); + } + + return commandAliases; +} + // =========================================================================== \ No newline at end of file diff --git a/scripts/server/help.js b/scripts/server/help.js index 9e66aa7e..5df17937 100644 --- a/scripts/server/help.js +++ b/scripts/server/help.js @@ -16,21 +16,10 @@ function initHelpScript() { // =========================================================================== let randomTips = [ - //`[#FFFFFF]Hold [#0066FF]E [#FFFFFF]to hail a nearby taxi if you need a ride.`, - //`[#FFFFFF]Press [#0066FF]G [#FFFFFF]to enter a vehicle as passenger.`, - //`[#FFFFFF]Banks can provide loans. Use [#AAAAAA]/help loans [#FFFFFF] for more details.`, - //`[#FFFFFF]Want to make a clan? Use [#AAAAAA]/help clans [#FFFFFF] for details.`, - //`[#FFFFFF]Weapons can be legally purchased at ammunation, if you have a weapon license.`, `[#FFFFFF]Look for yellow dots on your map for job locations.`, `[#FFFFFF]You can set custom key binds. Use [#AAAAAA]/help keys [#FFFFFF] for details.`, - //`[#FFFFFF]Tax is based on your total wealth. This includes money, vehicles, businesses and more.`, - //`[#FFFFFF]Don't go broke because of a hospital bill! Get insured today by visiting an insurance agency!`, - //`[#FFFFFF]Don't go broke because your car was destroyed. Visit an insurance agency today!`, - //`[#FFFFFF]You can find most locations by using [#AAAAAA]/gps`, `[#FFFFFF]Use /notips if you don't want to see tips and extra information`, - //`[#FFFFFF]Want to advertise your business? Visit the news station and place an /ad today!`, `[#FFFFFF]You can edit your keybinds using [#AAAAAA]/keybinds`, - //`[#FFFFFF]You can change your quick item display. Choices are GTAV-style pie menu or Minecraft-style hotbar`, `[#FFFFFF]Press I to see your inventory, and use number keys to select an item`, `[#FFFFFF]Use /buy at a business to purchase items.`, `[#FFFFFF]Found a bug? Report it with [#AAAAAA]/bug`, @@ -38,6 +27,19 @@ let randomTips = [ `[#FFFFFF]Want to buy a business? Use /bizbuy at one for sale`, `[#FFFFFF]Want to buy a house? Use /housebuy at one for sale`, `[#FFFFFF]Want to buy a vehicle? Visit a dealership and enter one for info on how to buy it!`, + `[#FFFFFF]Visit the forum at [#AAAAAA]asshatgaming.com`, + `[#FFFFFF]Chat with us on discord: [#AAAAAA]discord.asshatgaming.com`, + //`[#FFFFFF]Tax is based on your total wealth. This includes money, vehicles, businesses and more.`, + //`[#FFFFFF]Don't go broke because of a hospital bill! Get insured today by visiting an insurance agency!`, + //`[#FFFFFF]Don't go broke because your car was destroyed. Visit an insurance agency today!`, + //`[#FFFFFF]You can find most locations by using [#AAAAAA]/gps`, + //`[#FFFFFF]Want to advertise your business? Visit the news station and place an /ad today!`, + //`[#FFFFFF]You can change your quick item display. Choices are GTAV-style pie menu or Minecraft-style hotbar`, + //`[#FFFFFF]Hold [#0066FF]E [#FFFFFF]to hail a nearby taxi if you need a ride.`, + //`[#FFFFFF]Press [#0066FF]G [#FFFFFF]to enter a vehicle as passenger.`, + //`[#FFFFFF]Banks can provide loans. Use [#AAAAAA]/help loans [#FFFFFF] for more details.`, + //`[#FFFFFF]Want to make a clan? Use [#AAAAAA]/help clans [#FFFFFF] for details.`, + //`[#FFFFFF]Weapons can be legally purchased at ammunation, if you have a weapon license.`, ]; // =========================================================================== @@ -48,7 +50,9 @@ function helpCommand(command, params, client) { return false; } - switch(toLowerCase(params)) { + let splitParams = params.split(" "); + + switch(toLowerCase(splitParams[0])) { case "account": showAccountHelpMessage(client); break; @@ -109,6 +113,15 @@ function helpCommand(command, params, client) { showBindKeysHelpMessage(client); break; + case "command": + case "cmd": + if(areThereEnoughParams(params, 2, " ")) { + showCommandHelpMessage(client, splitParams[2]); + } else { + showCommandHelpMessage(client, false); + } + break; + default: showMainHelpMessage(client); break; @@ -130,6 +143,7 @@ function helpCommand(command, params, client) { // == Bindable Keys ============================ // == Clothes ================================== // == Business ================================= +// == Command Info ============================= // =========================================================================== @@ -265,6 +279,39 @@ function showBusinessHelpMessage(client) { // =========================================================================== +function showCommandHelpMessage(client, commandName) { + if(!commandName) { + messagePlayerSyntax(client, `${getCommandSyntaxText("help")} <command name>`); + return false; + } + + commandName = toLowerCase(commandName); + commandName = commandName.trim(); + + if(commandName.slice(0, 1) == "/") { + commandName = commandName.slice(1); + } + + let command = getCommandData(commandName); + let aliases = getCommandAliasesNames(command); + + messagePlayerInfo(client, "[#FF9900]== [#FFFF00]Command Info [#FF9900]============================="); + messagePlayerNormal(client, `[#FF9900]• [#FFFFFF]Description: ${command.description}`); + + if(aliases.length > 0) { + messagePlayerNormal(client, `[#FF9900]• [#FFFFFF]Aliases: ${aliases.join(", ")}`); + } else { + messagePlayerNormal(client, `[#FF9900]• [#FFFFFF]Aliases: (None)`); + } + + if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("basicModeration"))) { + //messagePlayerNormal(client, `[#FF9900]• [#FFFFFF]Required Flags: `); + messagePlayerNormal(client, `[#FF9900]• [#FFFFFF]Usable on Discord: ${getYesNoFromBool(command.allowOnDiscord)}`); + } +} + +// =========================================================================== + function showEnteredDriverSeatHasKeysHelpTip(client) { if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.enteredDriverSeat) { messagePlayerInfo(client, `You can press K for engine, I for lights, and L to lock/unlock the car.`); diff --git a/scripts/server/moderation.js b/scripts/server/moderation.js index d0b8e8cd..86ce0e66 100644 --- a/scripts/server/moderation.js +++ b/scripts/server/moderation.js @@ -706,4 +706,90 @@ function givePlayerMoneyCommand(command, params, client) { messagePlayerAlert(client, `An admin gave you [#AAAAAA]$${amount}`); } +// =========================================================================== + +function forcePlayerAccentCommand(command, params, client) { + if(areParamsEmpty(params)) { + messagePlayerSyntax(client, getCommandSyntaxText(command)); + return false; + } + + let splitParams = params.split(" "); + let targetClient = getPlayerFromParams(splitParams[0]); + let newAccent = splitParams[1] || "none"; + + if(!targetClient) { + messagePlayerError(client, "That player is not connected!"); + return false; + } + + if(toLowerCase(newAccent) == "none") { + newAccent = ""; + } + + setPlayerAccentText(client, newAccent); + + if(newAccent == "") { + messagePlayerSuccess(client, `You removed [#AAAAAA]${getCharacterFullName(targetClient)}'s [#FFFFFF]accent.`); + messagePlayerAlert(client, `An admin removed your accent.`); + } else { + messagePlayerSuccess(client, `You set [#AAAAAA]${getCharacterFullName(targetClient)}'s [#FFFFFF]accent to [#AAAAAA]${newAccent}`); + messagePlayerAlert(client, `An admin set your accent to [#AAAAAA]${newAccent}`); + } +} + +// =========================================================================== + +function forceCharacterNameChangeCommand(command, params, client) { + if(areParamsEmpty(params)) { + messagePlayerSyntax(client, getCommandSyntaxText(command)); + return false; + } + + let splitParams = params.split(" "); + let targetClient = getPlayerFromParams(splitParams[0]); + + if(!targetClient) { + messagePlayerError(client, "That player is not connected!"); + return false; + } + + messagePlayerSuccess(client, `You forced [#AAAAAA]${targetClient.name} (${getCharacterFullName(targetClient)}) [#FFFFFF]to change their character's name.`); + showPlayerNewCharacterFailedGUI(client, "Non-RP name! Choose a new one:"); +} + +// =========================================================================== + +function forceCharacterNameCommand(command, params, client) { + if(areParamsEmpty(params)) { + messagePlayerSyntax(client, getCommandSyntaxText(command)); + return false; + } + + if(areThereEnoughParams(params, 3, " ")) { + messagePlayerSyntax(client, getCommandSyntaxText(command)); + return false; + } + + let splitParams = params.split(" "); + let targetClient = getPlayerFromParams(splitParams[0]); + let firstName = splitParams[1]; + let lastName = splitParams[2]; + + if(!targetClient) { + messagePlayerError(client, "That player is not connected!"); + return false; + } + + firstName = fixCharacterName(firstName); + lastName = fixCharacterName(lastName); + let newName = `${firstName} ${lastName}`; + let oldName = getCharacterFullName(targetClient); + + getPlayerCurrentSubAccount(client).firstName = firstName; + getPlayerCurrentSubAccount(client).lastName = lastName; + + messagePlayerSuccess(client, `You forced [#AAAAAA]${targetClient.name}'s [#FFFFFF]current character name from [#AAAAAA]${oldName} [#FFFFFF]to [#AAAAAA]${newName}`); +} + // =========================================================================== \ No newline at end of file diff --git a/scripts/server/utilities.js b/scripts/server/utilities.js index f619df21..4ff1b125 100644 --- a/scripts/server/utilities.js +++ b/scripts/server/utilities.js @@ -1563,7 +1563,7 @@ function updateConnectionLogOnClientInfoReceive(client, clientVersion, screenWid // =========================================================================== function generateRandomPhoneNumber() { - return getRandom(100000,999999); + return getRandom(100000, 999999); } // =========================================================================== @@ -1582,7 +1582,7 @@ function doesNameContainInvalidCharacters(name) { // =========================================================================== function fixCharacterName(name) { - return String(name.charAt(0).toUpperCase()) + String(name.slice(1)); + return String(name.charAt(0).toUpperCase()) + String(name.slice(1).toLowerCase()); } // =========================================================================== \ No newline at end of file