diff --git a/scripts/server/locale/english.json b/locale/english.json similarity index 53% rename from scripts/server/locale/english.json rename to locale/english.json index 47d89847..3ce2fa6b 100644 --- a/scripts/server/locale/english.json +++ b/locale/english.json @@ -1,10 +1,10 @@ { "AccentNotFound": "Accent not found!", - "AccentSet": "You set your accent to {ALTCOLOUR}{%1}", + "AccentSet": "You set your accent to {ALTCOLOUR}{1}", "AnimationNotFound": "That animation doesn't exist!", - "AnimationCommandTip": "Use /animlist to see a list of valid animations", + "AnimationCommandTip": "Use {ALTCOLOUR}/animlist{MAINCOLOUR} to see a list of valid animations", "AnimationInvalidDistance": "The distance must be between 0 and 3!", - "AnimationStopCommandTip": "Use {ALTCOLOUR}/stopanim {RESETCOLOUR}to stop your animation", + "AnimationStopCommandTip": "Use {ALTCOLOUR}/stopanim{MAINCOLOUR} to stop your animation", "CantBanClient": "You cannot ban this person!", "PlayerAccountBanned": "{1} has been account banned" } \ No newline at end of file diff --git a/scripts/server/accent.js b/scripts/server/accent.js index b68ee521..f48aaf59 100644 --- a/scripts/server/accent.js +++ b/scripts/server/accent.js @@ -63,7 +63,7 @@ function listAccentsCommand(command, params, client) { let chunkedList = splitArrayIntoChunks(stationList, 8); - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Accents ${getInlineChatColourByType("clanOrange")}==================================`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Accents {clanOrange}==================================`); for(let i in chunkedList) { messagePlayerInfo(client, chunkedList[i].join(", ")); diff --git a/scripts/server/account.js b/scripts/server/account.js index b962a624..fb154c56 100644 --- a/scripts/server/account.js +++ b/scripts/server/account.js @@ -133,11 +133,11 @@ function toggleAccountLoginAttemptNotificationsCommand(command, params, client) if(!isAccountSettingFlagEnabled(getPlayerData(client).accountData, flagValue)) { getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue; - messagePlayerNormal(client, `⚙️ You will ${getBoolRedGreenInlineColour(true)}now ${getInlineChatColourByName("white")}be notified by email when somebody tries to login to your account`); + messagePlayerNormal(client, `⚙️ You will ${getBoolRedGreenInlineColour(true)}now {MAINCOLOUR}be notified by email when somebody tries to login to your account`); logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`); } else { getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings | flagValue; - messagePlayerNormal(client, `⚙️ You will ${getBoolRedGreenInlineColour(false)}not ${getInlineChatColourByName("white")}be notified by email when somebody tries to login to your account`); + messagePlayerNormal(client, `⚙️ You will ${getBoolRedGreenInlineColour(false)}not {MAINCOLOUR}be notified by email when somebody tries to login to your account`); logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`); } @@ -151,14 +151,14 @@ function toggleAccountServerLogoCommand(command, params, client) { if(!doesPlayerHaveLogoEnabled(client)) { getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings & ~flagValue; - messagePlayerNormal(client, `⚙️ You will ${getBoolRedGreenInlineColour(true)}now ${getInlineChatColourByName("white")}be shown the server logo (if enabled on current server)`); + messagePlayerNormal(client, `⚙️ You will ${getBoolRedGreenInlineColour(true)}now {MAINCOLOUR}be shown the server logo (if enabled on current server)`); logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo ON for their account`); if(getServerConfig().showLogo) { updatePlayerShowLogoState(client, true); } } else { getPlayerData(client).accountData.settings = getPlayerData(client).accountData.settings | flagValue; - messagePlayerNormal(client, `⚙️ You will ${getBoolRedGreenInlineColour(false)}not ${getInlineChatColourByName("white")}be shown the server logo.`); + messagePlayerNormal(client, `⚙️ You will ${getBoolRedGreenInlineColour(false)}not {MAINCOLOUR}be shown the server logo.`); logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo OFF for their account`); updatePlayerShowLogoState(client, false); } @@ -176,25 +176,25 @@ function toggleAccountTwoFactorAuthCommand(command, params, client) { if(getEmailConfig().enabled) { if(getPlayerData(client).accountData.emailAddress != "") { messagePlayerError(client, `You need to add your email to your account to use two-factor authentication.`); - messagePlayerTip(client, `${getInlineChatColourByName("white")}Use ${getInlineChatColourByName("lightGrey")}/setemail ${getInlineChatColourByName("white")}to add your email.`); + messagePlayerTip(client, `{MAINCOLOUR}Use {ALTCOLOUR}/setemail {MAINCOLOUR}to add your email.`); return false; } if(isAccountEmailVerified(getPlayerData(client).accountData)) { messagePlayerError(client, `You need to verify your email to your account to use two-factor authentication.`); - messagePlayerTip(client, `${getInlineChatColourByName("white")}Use ${getInlineChatColourByName("lightGrey")}/verifyemail ${getInlineChatColourByName("white")}to verify your email.`); + messagePlayerTip(client, `{MAINCOLOUR}Use {ALTCOLOUR}/verifyemail {MAINCOLOUR}to verify your email.`); return false; } } if(!doesPlayerHaveTwoFactorAuthEnabled(client)) { getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue); - messagePlayerSuccess(client, `${getInlineChatColourByName("white")}You have turned ${getBoolRedGreenInlineColour(false)}ON ${getInlineChatColourByName("white")} two factor authentication!${getInlineChatColourByName("lightGrey")}${addtoAuthenticatorCode}`); + messagePlayerSuccess(client, `{MAINCOLOUR}You have turned ${getBoolRedGreenInlineColour(false)}ON {MAINCOLOUR} two factor authentication!{ALTCOLOUR}${addtoAuthenticatorCode}`); messagePlayerAlert(client, `You will be required to enter a code sent to your email every time you log on.`); logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication ON for their account`); } else { getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue); - messagePlayerSuccess(client, `You have turned ${getBoolRedGreenInlineColour(false)}OFF ${getInlineChatColourByName("white")}two-factor authentication for login.`); + messagePlayerSuccess(client, `You have turned ${getBoolRedGreenInlineColour(false)}OFF {MAINCOLOUR}two-factor authentication for login.`); messagePlayerAlert(client, `You won't be required to enter a code sent to your email every time you log on anymore.`); logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication OFF for their account`); } diff --git a/scripts/server/animation.js b/scripts/server/animation.js index 0caca402..21ebce09 100644 --- a/scripts/server/animation.js +++ b/scripts/server/animation.js @@ -65,7 +65,7 @@ function showAnimationListCommand(command, params, client) { let chunkedList = splitArrayIntoChunks(animList, 10); - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Animation List ${getInlineChatColourByType("clanOrange")}===========================`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Animation List {clanOrange}===========================`); for(let i in chunkedList) { messagePlayerInfo(client, chunkedList[i].join(", ")); diff --git a/scripts/server/business.js b/scripts/server/business.js index 51dbad3a..00a44d5f 100644 --- a/scripts/server/business.js +++ b/scripts/server/business.js @@ -153,7 +153,7 @@ function createBusinessCommand(command, params, client) { createBusinessEntranceBlip(businessId-1); createBusinessExitBlip(businessId-1); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}created business ${getInlineChatColourByType("businessBlue")}${tempBusinessData.name}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}created business {businessBlue}${tempBusinessData.name}`); } // =========================================================================== @@ -179,7 +179,7 @@ function createBusinessLocationCommand(command, params, client) { let tempBusinessLocationData = createBusinessLocation(locationType, businessId); getServerData().businesses[businessId].push(tempBusinessLocationData); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}created location ${getInlineChatColourByType("businessBlue")}${params} ${getInlineChatColourByName("white")}for business ${getInlineChatColourByType("businessBlue")}${tempBusinessData.name}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}created location {businessBlue}${params} {MAINCOLOUR}for business {businessBlue}${tempBusinessData.name}`); } // =========================================================================== @@ -219,7 +219,7 @@ function deleteBusinessCommand(command, params, client) { return false; } - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}deleted business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}deleted business {businessBlue}${getBusinessData(businessId).name}`); deleteBusiness(businessId, getPlayerData(client).accountData.databaseId); } @@ -252,7 +252,7 @@ function setBusinessNameCommand(command, params, client) { getBusinessData(businessId).name = newBusinessName; setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.name", getBusinessData(businessId).name, true); getBusinessData(businessId).needsSaved = true; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}renamed business ${getInlineChatColourByType("businessBlue")}${oldBusinessName} ${getInlineChatColourByName("white")}to ${getInlineChatColourByType("businessBlue")}${newBusinessName}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}renamed business {businessBlue}${oldBusinessName} {MAINCOLOUR}to {businessBlue}${newBusinessName}`); } // =========================================================================== @@ -285,7 +285,7 @@ function setBusinessOwnerCommand(command, params, client) { getBusinessData(businessId).ownerId = getPlayerCurrentSubAccount(newBusinessOwner).databaseId; getBusinessData(businessId).needsSaved = true; - messagePlayerSuccess(`${getInlineChatColourByName("white")}You gave business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}to ${getInlineChatColourByName("lightGrey")}${newBusinessOwner.name}`); + messagePlayerSuccess(`{MAINCOLOUR}You gave business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}to {ALTCOLOUR}${newBusinessOwner.name}`); } // =========================================================================== @@ -314,7 +314,7 @@ function setBusinessClanCommand(command, params, client) { getBusinessData(businessId).ownerId = getClanData(clanId).databaseId; getBusinessData(businessId).needsSaved = true; - messagePlayerSuccess(`${getInlineChatColourByName("white")}You gave business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}to the ${getInlineChatColourByType("clanOrange")}${getClanData(clanId).name} ${getInlineChatColourByName("white")}clan!`); + messagePlayerSuccess(`{MAINCOLOUR}You gave business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}to the {clanOrange}${getClanData(clanId).name} {MAINCOLOUR}clan!`); } // =========================================================================== @@ -368,7 +368,7 @@ function setBusinessClanCommand(command, params, client) { getBusinessData(businessId).clanRank = getClanRankData(clanId, clanRankId).level; getBusinessData(businessId).needsSaved = true; - messagePlayerSuccess(`${getInlineChatColourByName("white")}You set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name}${getInlineChatColourByName("white")}'s clan rank to ${getInlineChatColourByType("clanOrange")}${getClanRankData(clanId, clanRankId).name} ${getInlineChatColourByName("white")}(level ${getClanRankData(clanId, clanRankId).level}) and above!`); + messagePlayerSuccess(`{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR}'s clan rank to {clanOrange}${getClanRankData(clanId, clanRankId).name} {MAINCOLOUR}(level ${getClanRankData(clanId, clanRankId).level}) and above!`); } // =========================================================================== @@ -401,7 +401,7 @@ function setBusinessJobCommand(command, params, client) { getBusinessData(businessId).ownerId = getJobData(jobId).databaseId; getBusinessData(businessId).needsSaved = true; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}owner to the ${getInlineChatColourByType("jobYellow")}${getJobData(jobId).name} ${getInlineChatColourByName("white")}job`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner to the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`); } // =========================================================================== @@ -422,7 +422,7 @@ function setBusinessPublicCommand(command, params, client) { getBusinessData(businessId).ownerId = 0; getBusinessData(businessId).needsSaved = true; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}owner set to ${getInlineChatColourByName("lightGrey")}public`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner set to {ALTCOLOUR}public`); } // =========================================================================== @@ -448,7 +448,7 @@ function lockUnlockBusinessCommand(command, params, client) { setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.locked", getBusinessData(businessId).locked, true); getBusinessData(businessId).needsSaved = true; - messagePlayerSuccess(client, `${getLockedUnlockedEmojiFromBool((getBusinessData(businessId).locked))} Business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}${getLockedUnlockedTextFromBool((getBusinessData(businessId).locked))}!`); + messagePlayerSuccess(client, `${getLockedUnlockedEmojiFromBool((getBusinessData(businessId).locked))} Business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}${getLockedUnlockedTextFromBool((getBusinessData(businessId).locked))}!`); } // =========================================================================== @@ -501,7 +501,7 @@ function setBusinessEntranceFeeCommand(command, params, client) { getBusinessData(businessId).entranceFee = entranceFee; getBusinessData(businessId).needsSaved = true; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}entrance fee to [#AAAAAAA]$${entranceFee}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}entrance fee to [#AAAAAAA]$${entranceFee}`); } // =========================================================================== @@ -542,7 +542,7 @@ function getBusinessInfoCommand(command, params, client) { break; } - messagePlayerInfo(client, `🏢 ${getInlineChatColourByType("businessBlue")}[Business Info] ${getInlineChatColourByName("white")}Name: ${getInlineChatColourByName("lightGrey")}${getBusinessData(businessId).name}, ${getInlineChatColourByName("white")}Owner: ${getInlineChatColourByName("lightGrey")}${ownerName} (${getBusinessOwnerTypeText(getBusinessData(businessId).ownerType)}), ${getInlineChatColourByName("white")}Locked: ${getInlineChatColourByName("lightGrey")}${getYesNoFromBool(intToBool(getBusinessData(businessId).locked))}, ${getInlineChatColourByName("white")}ID: ${getInlineChatColourByName("lightGrey")}${businessId}/${getBusinessData(businessId).databaseId}`); + messagePlayerInfo(client, `🏢 {businessBlue}[Business Info] {MAINCOLOUR}Name: {ALTCOLOUR}${getBusinessData(businessId).name}, {MAINCOLOUR}Owner: {ALTCOLOUR}${ownerName} (${getBusinessOwnerTypeText(getBusinessData(businessId).ownerType)}), {MAINCOLOUR}Locked: {ALTCOLOUR}${getYesNoFromBool(intToBool(getBusinessData(businessId).locked))}, {MAINCOLOUR}ID: {ALTCOLOUR}${businessId}/${getBusinessData(businessId).databaseId}`); } // =========================================================================== @@ -560,7 +560,7 @@ function setBusinessPickupCommand(command, params, client) { if(isNaN(typeParam)) { if(isNull(getGameConfig().pickupModels[getServerGame()][typeParam])) { messagePlayerError(client, "Invalid business type! Use a business type name or a pickup model ID"); - messagePlayerInfo(client, `Pickup Types: ${getInlineChatColourByName("lightGrey")}${Object.keys(getGameConfig().pickupModels[getServerGame()]).join(", ")}`) + messagePlayerInfo(client, `Pickup Types: {ALTCOLOUR}${Object.keys(getGameConfig().pickupModels[getServerGame()]).join(", ")}`) return false; } @@ -573,7 +573,7 @@ function setBusinessPickupCommand(command, params, client) { getBusinessData(businessId).needsSaved = true; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}pickup display to ${getInlineChatColourByName("lightGrey")}${toLowerCase(typeParam)}'!`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}pickup display to {ALTCOLOUR}${toLowerCase(typeParam)}'!`); } // =========================================================================== @@ -595,13 +595,13 @@ function setBusinessInteriorTypeCommand(command, params, client) { getBusinessData(businessId).exitInterior = -1; getBusinessData(businessId).hasInterior = false; getBusinessData(businessId).exitPickupModel = -1; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}removed business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}interior`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}removed business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}interior`); return false; } if(isNull(getGameConfig().interiorTemplates[getServerGame()][typeParam])) { messagePlayerError(client, "Invalid interior type! Use an interior type name"); - messagePlayerInfo(client, `Interior Types: ${getInlineChatColourByName("lightGrey")}${Object.keys(getGameConfig().interiorTemplates[getServerGame()]).join(", ")}`) + messagePlayerInfo(client, `Interior Types: {ALTCOLOUR}${Object.keys(getGameConfig().interiorTemplates[getServerGame()]).join(", ")}`) return false; } @@ -621,7 +621,7 @@ function setBusinessInteriorTypeCommand(command, params, client) { getBusinessData(businessId).needsSaved = true; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}interior type to ${getInlineChatColourByName("lightGrey")}${toLowerCase(typeParam)}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}interior type to {ALTCOLOUR}${toLowerCase(typeParam)}`); } // =========================================================================== @@ -640,7 +640,7 @@ function setBusinessBlipCommand(command, params, client) { if(isNaN(typeParam)) { if(isNull(getGameConfig().blipSprites[getServerGame()][typeParam])) { messagePlayerError(client, "Invalid business type! Use a business type name or a blip image ID"); - messagePlayerInfo(client, `Blip Types: ${getInlineChatColourByName("lightGrey")}${Object.keys(getGameConfig().blipSprites[getServerGame()]).join(", ")}`) + messagePlayerInfo(client, `Blip Types: {ALTCOLOUR}${Object.keys(getGameConfig().blipSprites[getServerGame()]).join(", ")}`) return false; } @@ -652,7 +652,7 @@ function setBusinessBlipCommand(command, params, client) { resetBusinessBlips(businessId); getBusinessData(businessId).needsSaved = true; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}blip display to ${getInlineChatColourByName("lightGrey")}${toLowerCase(typeParam)}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}blip display to {ALTCOLOUR}${toLowerCase(typeParam)}`); } // =========================================================================== @@ -673,7 +673,7 @@ function giveDefaultItemsToBusinessCommand(command, params, client) { if(isNull(getGameConfig().defaultBusinessItems[getServerGame()][typeParam])) { messagePlayerError(client, "Invalid business items type! Use a business items type name"); - messagePlayerInfo(client, `Blip Types: ${getInlineChatColourByName("lightGrey")}${Object.keys(getGameConfig().defaultBusinessItems[getServerGame()]).join(", ")}`) + messagePlayerInfo(client, `Blip Types: {ALTCOLOUR}${Object.keys(getGameConfig().defaultBusinessItems[getServerGame()]).join(", ")}`) return false; } @@ -688,7 +688,7 @@ function giveDefaultItemsToBusinessCommand(command, params, client) { cacheBusinessItems(businessId); updateBusinessPickupLabelData(businessId); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}gave business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}the default items for ${toLowerCase(typeParam)}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}gave business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}the default items for ${toLowerCase(typeParam)}`); } // =========================================================================== @@ -704,7 +704,7 @@ function setBusinessEntranceLabelToDealershipCommand(command, params, client) { } updateBusinessPickupLabelData(businessId); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}gave business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}the default items for ${toLowerCase(typeParam)}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}gave business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}the default items for ${toLowerCase(typeParam)}`); } // =========================================================================== @@ -726,7 +726,7 @@ function deleteBusinessFloorItemsCommand(command, params, client) { cacheBusinessItems(businessId); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}deleted all on-sale items for business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}deleted all on-sale items for business {businessBlue}${getBusinessData(businessId).name}`); } // =========================================================================== @@ -748,7 +748,7 @@ function deleteBusinessStorageItemsCommand(command, params, client) { cacheBusinessItems(businessId); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}deleted all stored items for business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}deleted all stored items for business {businessBlue}${getBusinessData(businessId).name}`); } // =========================================================================== @@ -775,7 +775,7 @@ function withdrawFromBusinessCommand(command, params, client) { } if(getBusinessData(businessId).till < amount) { - messagePlayerError(client, `Business ${getInlineChatColourByType("businessBlue")}${tempBusinessData.name} doesn't have that much money! Use /bizbalance.`); + messagePlayerError(client, `Business {businessBlue}${tempBusinessData.name} doesn't have that much money! Use /bizbalance.`); return false; } @@ -784,7 +784,7 @@ function withdrawFromBusinessCommand(command, params, client) { updatePlayerCash(client); getBusinessData(businessId).needsSaved = true; - messagePlayerSuccess(client, `You withdrew $${amount} from business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} till`); + messagePlayerSuccess(client, `You withdrew $${amount} from business {businessBlue}${getBusinessData(businessId).name} till`); } // =========================================================================== @@ -819,7 +819,7 @@ function setBusinessBuyPriceCommand(command, params, client) { setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.price", getBusinessData(businessId).buyPrice, true); getBusinessData(businessId).needsSaved = true; - messagePlayerSuccess(client, `${getInlineChatColourByName("white")}You set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name}'s ${getInlineChatColourByName("white")}for-sale price to ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(amount)}`); + messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}'s {MAINCOLOUR}for-sale price to {ALTCOLOUR}$${makeLargeNumberReadable(amount)}`); } // =========================================================================== @@ -856,7 +856,7 @@ function depositIntoBusinessCommand(command, params, client) { updatePlayerCash(client); getBusinessData(businessId).needsSaved = true; - messagePlayerSuccess(client, `You deposited $${amount} into business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}till`); + messagePlayerSuccess(client, `You deposited $${amount} into business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}till`); } // =========================================================================== @@ -877,7 +877,7 @@ function orderItemForBusinessCommand(command, params, client) { if(!getItemTypeData(itemType)) { messagePlayerError(client, `Invalid item type name or ID!`); - messagePlayerInfo(client, `Use ${getInlineChatColourByName("lightGrey")}/itemtypes ${getInlineChatColourByName("white")}for a list of items`); + messagePlayerInfo(client, `Use {ALTCOLOUR}/itemtypes {MAINCOLOUR}for a list of items`); return false; } let pricePerItem = getOrderPriceForItemType(itemType); @@ -916,13 +916,13 @@ function orderItemForBusinessCommand(command, params, client) { function orderItemForBusiness(businessId, itemType, amount) { if(getBusinessData(businessId).till < orderTotalCost) { let neededAmount = orderTotalCost-getBusinessData(businessId).till; - //messagePlayerError(client, `The business doesn't have enough money (needs ${getInlineChatColourByName("lightGrey")}$${neededAmount} ${getInlineChatColourByName("white")}more)! Use ${getInlineChatColourByName("lightGrey")}/bizdeposit ${getInlineChatColourByName("white")}to add money to the business.`); + //messagePlayerError(client, `The business doesn't have enough money (needs {ALTCOLOUR}$${neededAmount} {MAINCOLOUR}more)! Use {ALTCOLOUR}/bizdeposit {MAINCOLOUR}to add money to the business.`); return false; } getBusinessData(businessId).till -= orderTotalCost; addToBusinessInventory(businessId, itemType, amount); - //messagePlayerSuccess(client, `You ordered ${amount} ${getPluralForm(getItemTypeData(itemType).name)} (${getItemValueDisplay(itemType, value)}) at $${getItemTypeData(itemType).orderPrice} each for business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name}`); + //messagePlayerSuccess(client, `You ordered ${amount} ${getPluralForm(getItemTypeData(itemType).name)} (${getItemValueDisplay(itemType, value)}) at $${getItemTypeData(itemType).orderPrice} each for business {businessBlue}${getBusinessData(businessId).name}`); } // =========================================================================== @@ -944,7 +944,7 @@ function viewBusinessTillAmountCommand(command, params, client) { return false; } - messagePlayerSuccess(client, `Business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}till has ${getInlineChatColourByName("lightGrey")}$${getBusinessData(businessId).till}`); + messagePlayerSuccess(client, `Business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}till has {ALTCOLOUR}$${getBusinessData(businessId).till}`); } // =========================================================================== @@ -958,12 +958,12 @@ function buyBusinessCommand(command, params, client) { } if(getBusinessData(businessId).buyPrice <= 0) { - messagePlayerError(client, `Business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}is not for sale!`); + messagePlayerError(client, `Business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}is not for sale!`); return false; } if(getPlayerCurrentSubAccount(client).cash < getBusinessData(businessId).buyPrice) { - messagePlayerError(client, `You don't have enough money to buy business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name}!`); + messagePlayerError(client, `You don't have enough money to buy business {businessBlue}${getBusinessData(businessId).name}!`); return false; } @@ -974,7 +974,7 @@ function buyBusinessCommand(command, params, client) { updateBusinessPickupLabelData(businessId); getBusinessData(businessId).needsSaved = true; - messagePlayerSuccess(client, `You are now the owner of ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name}`); + messagePlayerSuccess(client, `You are now the owner of {businessBlue}${getBusinessData(businessId).name}`); } // =========================================================================== @@ -1005,7 +1005,7 @@ function moveBusinessEntranceCommand(command, params, client) { getBusinessData(businessId).needsSaved = true; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}moved business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}entrance to their position`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}moved business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}entrance to their position`); } // =========================================================================== @@ -1034,7 +1034,7 @@ function moveBusinessExitCommand(command, params, client) { getBusinessData(businessId).needsSaved = true; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}moved business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}exit to their position`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}moved business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}exit to their position`); } // =========================================================================== @@ -1516,7 +1516,7 @@ function buyFromBusinessCommand(command, params, client) { if(getBusinessData(businessId).hasInterior) { if(!getPlayerBusiness(client)) { if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) { - messagePlayerTip(client, `You need to enter the business first! Press ${getInlineChatColourByName("lightGrey")}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "enter")).key)} ${getInlineChatColourByName("white")}to enter and exit a business`); + messagePlayerTip(client, `You need to enter the business first! Press {ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "enter")).key)} {MAINCOLOUR}to enter and exit a business`); } else { messagePlayerNormal(client, `You need to enter the business first! Use /enter to enter and exit a business`); } @@ -1562,7 +1562,7 @@ function buyFromBusinessCommand(command, params, client) { let priceEach = (amount > 1) ? `($${individualCost} each)` : ``; if(getPlayerCurrentSubAccount(client).cash < totalCost) { - messagePlayerError(client, `You don't have enough money! You need ${getInlineChatColourByName("lightGrey")}${getBusinessData(businessId).floorItemCache[itemSlot-1].buyPrice*amount-getPlayerCurrentSubAccount(client).cash} ${getInlineChatColourByName("white")}more!`); + messagePlayerError(client, `You don't have enough money! You need {ALTCOLOUR}${getBusinessData(businessId).floorItemCache[itemSlot-1].buyPrice*amount-getPlayerCurrentSubAccount(client).cash} {MAINCOLOUR}more!`); return false; } @@ -1576,7 +1576,7 @@ function buyFromBusinessCommand(command, params, client) { destroyItem(getBusinessData(businessId).floorItemCache[itemSlot-1]); } - //messagePlayerSuccess(client, `You bought ${amount} ${getInlineChatColourByName("lightGrey")}${itemName} ${getInlineChatColourByName("white")}for ${totalCost} ${priceEach}`); + //messagePlayerSuccess(client, `You bought ${amount} {ALTCOLOUR}${itemName} {MAINCOLOUR}for ${totalCost} ${priceEach}`); meActionToNearbyPlayers(client, `buys a ${itemName}`); if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand("inv")) { @@ -1619,7 +1619,7 @@ function setBusinessItemSellPriceCommand(command, params, client) { getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).buyPrice = newPrice; - messagePlayerSuccess(client, `You changed the price of the ${getInlineChatColourByName("lightGrey")}${getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).itemTypeIndex).name}'s ${getInlineChatColourByName("white")}in slot ${getInlineChatColourByName("lightGrey")}${itemSlot} ${getInlineChatColourByName("white")}from $${makeLargeNumberReadable(oldPrice)} to $${makeLargeNumberReadable(newprice)}`); + messagePlayerSuccess(client, `You changed the price of the {ALTCOLOUR}${getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot-1]).itemTypeIndex).name}'s {MAINCOLOUR}in slot {ALTCOLOUR}${itemSlot} {MAINCOLOUR}from $${makeLargeNumberReadable(oldPrice)} to $${makeLargeNumberReadable(newprice)}`); } // =========================================================================== diff --git a/scripts/server/chat.js b/scripts/server/chat.js index a7bfaf99..bbca63bf 100644 --- a/scripts/server/chat.js +++ b/scripts/server/chat.js @@ -72,8 +72,9 @@ function megaphoneChatCommand(command, params, client) { return false; } - if(canPlayerUseMegaphone(client)) { - + if(!canPlayerUseMegaphone(client)) { + messagePlayerError(client, "You must have a megaphone item or be in an emergency vehicle!"); + return false; } megaPhoneToNearbyPlayers(client, params); @@ -127,7 +128,7 @@ function adminChatCommand(command, params, client) { return false; } - messageAdmins(`${getInlineChatColourByType("jobYellow")}[Admin Chat] ${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} [#CCCCCC](${getPlayerStaffTitle(client)})${getInlineChatColourByName("white")}: ${params}`); + messageAdmins(`{jobYellow}[Admin Chat] {ALTCOLOUR}${getPlayerName(client)} [#CCCCCC](${getPlayerStaffTitle(client)}){MAINCOLOUR}: ${params}`); } // =========================================================================== @@ -162,7 +163,7 @@ function talkToNearbyPlayers(client, messageText) { function phoneOutgoingToNearbyPlayers(client, messageText) { let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().talkDistance); for(let i in clients) { - messagePlayerNormal(`[#CCCCCC]${getCharacterFullName(client)} ${getInlineChatColourByName("lightGrey")}(to phone): ${getInlineChatColourByName("white")}${messageText}`); + messagePlayerNormal(`[#CCCCCC]${getCharacterFullName(client)} {ALTCOLOUR}(to phone): {MAINCOLOUR}${messageText}`); } } @@ -171,7 +172,7 @@ function phoneOutgoingToNearbyPlayers(client, messageText) { function phoneIncomingToNearbyPlayers(client, messageText) { let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().radioSpeakerDistance); for(let i in clients) { - messagePlayerNormal(`[#CCCCCC]${getCharacterFullName(client)} ${getInlineChatColourByName("lightGrey")}(from phone): ${getInlineChatColourByName("white")}${messageText}`); + messagePlayerNormal(`[#CCCCCC]${getCharacterFullName(client)} {ALTCOLOUR}(from phone): {MAINCOLOUR}${messageText}`); } } @@ -244,7 +245,7 @@ function clanChat(client, messageText) { // =========================================================================== function canPlayerUseMegaphone(client) { - if(isPlayerHoldingItemOfType(client, VRR_ITEM_USETYPE_MEGAPHONE)) { + if(getPlayerFirstItemSlotByUseType(client, VRR_ITEM_USETYPE_MEGAPHONE) != -1) { if(isPlayerActiveItemEnabled(client)) { return true; } diff --git a/scripts/server/clan.js b/scripts/server/clan.js index b1d6e481..783fc1f6 100644 --- a/scripts/server/clan.js +++ b/scripts/server/clan.js @@ -144,7 +144,7 @@ function listClansCommand(command, params, client) { let chunkedList = splitArrayIntoChunks(nameList, 5); - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Clans ${getInlineChatColourByType("clanOrange")}====================================`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Clans {clanOrange}====================================`); for(let i in chunkedList) { messagePlayerInfo(client, chunkedList[i].join(", ")); @@ -171,7 +171,7 @@ function listClanRanksCommand(command, params, client) { let chunkedList = splitArrayIntoChunks(rankNameList, 5); - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Clan Ranks (${getClanData(clanId).name}) ${getInlineChatColourByType("clanOrange")}=====================`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Clan Ranks (${getClanData(clanId).name}) {clanOrange}=====================`); for(let i in chunkedList) { messagePlayerInfo(client, chunkedList[i].join(", ")); @@ -193,7 +193,7 @@ function createClanCommand(command, params, client) { // Create clan without owner. Can set owner with /clanowner afterward createClan(params); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}created clan ${getInlineChatColourByType("clanOrange")}${params}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}created clan {clanOrange}${params}`); } // =========================================================================== @@ -211,7 +211,7 @@ function deleteClanCommand(command, params, client) { return false; } - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}deleted clan ${getInlineChatColourByType("clanOrange")}${getClanData(clanId).name}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}deleted clan {clanOrange}${getClanData(clanId).name}`); deleteClan(clanId); } @@ -246,7 +246,7 @@ function setClanOwnerCommand(command, params, client) { getPlayerCurrentSubAccount(targetClient).clan = getClanData(clanId).databaseId; getPlayerCurrentSubAccount(targetClient).clanFlags = getClanFlagValue("all"); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set clan ${getInlineChatColourByType("clanOrange")}${getClanData(clanId).name} ${getInlineChatColourByName("white")}owner to ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(targetClient)}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set clan {clanOrange}${getClanData(clanId).name} {MAINCOLOUR}owner to {ALTCOLOUR}${getCharacterFullName(targetClient)}`); } // =========================================================================== @@ -271,7 +271,7 @@ function setClanTagCommand(command, params, client) { getClanData(clanId).params = params; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set clan ${getInlineChatColourByType("clanOrange")}${getClanData(clanId).index} ${getInlineChatColourByName("white")}tag to ${getInlineChatColourByName("lightGrey")}${params}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set clan {clanOrange}${getClanData(clanId).index} {MAINCOLOUR}tag to {ALTCOLOUR}${params}`); } // =========================================================================== @@ -296,7 +296,7 @@ function setClanNameCommand(command, params, client) { getClanData(clanId).name = params; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set clan ${getInlineChatColourByType("clanOrange")}${getClanData(clanId).index} ${getInlineChatColourByName("white")}name to ${getInlineChatColourByName("lightGrey")}${params}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set clan {clanOrange}${getClanData(clanId).index} {MAINCOLOUR}name to {ALTCOLOUR}${params}`); } // =========================================================================== @@ -325,8 +325,8 @@ function createClanRankCommand(command, params, client) { let rankIndex = createClanRank(clanId, rankId, rankName); - messagePlayerSuccess(client, `You added the ${getInlineChatColourByName("lightGrey")}${rankName} ${getInlineChatColourByName("white")}rank (Level ${getInlineChatColourByName("lightGrey")}${rankId}`); - messagePlayerSuccess(client, `Use ${getInlineChatColourByName("lightGrey")}/addclanrankflag ${rankName} ${getInlineChatColourByName("white")} to add permission flags to this rank.`); + messagePlayerSuccess(client, `You added the {ALTCOLOUR}${rankName} {MAINCOLOUR}rank (Level {ALTCOLOUR}${rankId}`); + messagePlayerSuccess(client, `Use {ALTCOLOUR}/addclanrankflag ${rankName} {MAINCOLOUR} to add permission flags to this rank.`); } // =========================================================================== @@ -359,7 +359,7 @@ function deleteClanRankCommand(command, params, client) { removeClanRank(clanId, rankId); - messagePlayerSuccess(client, `You removed the ${getInlineChatColourByName("lightGrey")}${tempRankName} ${getInlineChatColourByName("white")}rank`); + messagePlayerSuccess(client, `You removed the {ALTCOLOUR}${tempRankName} {MAINCOLOUR}rank`); } // =========================================================================== @@ -404,8 +404,8 @@ function setClanMemberTagCommand(command, params, client) { getPlayerCurrentSubAccount(targetClient).clanTag = splitParams[1]; - messagePlayerSuccess(client, `You set ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(targetClient)}'s ${getInlineChatColourByName("white")}clan tag to ${getInlineChatColourByName("lightGrey")}${splitParams[1]}`); - messagePlayerAlert(client, `${getInlineChatColourByName("lightGrey")}${getCharacterFullName(targetClient)} ${getInlineChatColourByName("white")}set your clan tag to ${getInlineChatColourByName("lightGrey")}${splitParams[1]}`); + messagePlayerSuccess(client, `You set {ALTCOLOUR}${getCharacterFullName(targetClient)}'s {MAINCOLOUR}clan tag to {ALTCOLOUR}${splitParams[1]}`); + messagePlayerAlert(client, `{ALTCOLOUR}${getCharacterFullName(targetClient)} {MAINCOLOUR}set your clan tag to {ALTCOLOUR}${splitParams[1]}`); } // =========================================================================== @@ -486,7 +486,7 @@ function addClanMemberFlagCommand(command, params, client) { let flagValue = getClanFlagValue(splitParams[1]); getPlayerCurrentSubAccount(client).clanFlags = getPlayerCurrentSubAccount(client).clanFlags | flagValue; - messagePlayerSuccess(client, `You added the ${getInlineChatColourByName("lightGrey")}${splitParams[1]} ${getInlineChatColourByName("white")}clan flag to ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(client)}`); + messagePlayerSuccess(client, `You added the {ALTCOLOUR}${splitParams[1]} {MAINCOLOUR}clan flag to {ALTCOLOUR}${getCharacterFullName(client)}`); } // =========================================================================== @@ -538,7 +538,7 @@ function removeClanMemberFlagCommand(command, params, client) { let flagValue = getClanFlagValue(splitParams[1]); getPlayerCurrentSubAccount(client).clanFlags = getPlayerCurrentSubAccount(client).clanFlags & ~flagValue; - messagePlayerSuccess(client, `You removed the ${getInlineChatColourByName("lightGrey")}${splitParams[1]} ${getInlineChatColourByName("white")}clan flag from ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(client)}`); + messagePlayerSuccess(client, `You removed the {ALTCOLOUR}${splitParams[1]} {MAINCOLOUR}clan flag from {ALTCOLOUR}${getCharacterFullName(client)}`); } // =========================================================================== @@ -577,7 +577,7 @@ function addClanRankFlagCommand(command, params, client) { let flagValue = getClanFlagValue(splitParams[1]); getClanRankData(clanId, rankId).flags = getClanRankData(clanId, rankId).flags | flagValue; - messagePlayerSuccess(client, `You added the ${getInlineChatColourByName("lightGrey")}${splitParams[1]} ${getInlineChatColourByName("white")}clan flag to rank ${getInlineChatColourByName("lightGrey")}${getClanRankData(clanId, rankId).name}`); + messagePlayerSuccess(client, `You added the {ALTCOLOUR}${splitParams[1]} {MAINCOLOUR}clan flag to rank {ALTCOLOUR}${getClanRankData(clanId, rankId).name}`); } // =========================================================================== @@ -616,7 +616,7 @@ function removeClanRankFlagCommand(command, params, client) { let flagValue = getClanFlagValue(splitParams[1]); getClanRankData(clanId, rankId).flags = getClanRankData(clanId, rankId).flags & ~flagValue; - messagePlayerSuccess(client, `You removed the ${getInlineChatColourByName("lightGrey")}${splitParams[1]} ${getInlineChatColourByName("white")}clan flag from rank ${getInlineChatColourByName("lightGrey")}${getClanRankData(clanId, rankId).name}`); + messagePlayerSuccess(client, `You removed the {ALTCOLOUR}${splitParams[1]} {MAINCOLOUR}clan flag from rank {ALTCOLOUR}${getClanRankData(clanId, rankId).name}`); } // =========================================================================== @@ -663,7 +663,7 @@ function setClanMemberTitleCommand(command, params, client) { let oldMemberTitle = getPlayerCurrentSubAccount(client).clanTitle; getPlayerCurrentSubAccount(client).clanTitle = splitParams[1]; - messagePlayerSuccess(client, `You changed the name of ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(client)} ${getInlineChatColourByName("white")}from ${getInlineChatColourByName("lightGrey")}${oldMemberTitle} ${getInlineChatColourByName("white")}to ${getInlineChatColourByName("lightGrey")}${params}`); + messagePlayerSuccess(client, `You changed the name of {ALTCOLOUR}${getCharacterFullName(client)} {MAINCOLOUR}from {ALTCOLOUR}${oldMemberTitle} {MAINCOLOUR}to {ALTCOLOUR}${params}`); } // =========================================================================== @@ -696,7 +696,7 @@ function setClanRankTitleCommand(command, params, client) { let oldRankName = getClanRankData(clanId, rankId).name; getClanRankData(clanId, rankId).name = splitParams[1]; - messagePlayerSuccess(client, `You changed the name of rank ${rankId} from ${getInlineChatColourByName("lightGrey")}${oldRankName} ${getInlineChatColourByName("white")}to ${getInlineChatColourByName("lightGrey")}${params}`); + messagePlayerSuccess(client, `You changed the name of rank ${rankId} from {ALTCOLOUR}${oldRankName} {MAINCOLOUR}to {ALTCOLOUR}${params}`); } // =========================================================================== @@ -757,7 +757,7 @@ function setClanMemberRankCommand(command, params, client) { let oldClanRank = getClanRankData(clanId, getPlayerClanRank(targetClient)); getPlayerCurrentSubAccount(targetClient).clanRank = getClanRankData(clanId, rankId).databaseId; getPlayerCurrentSubAccount(targetClient).clanRankIndex = rankId; - messagePlayerSuccess(client, `You changed ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(targetClient)}'s ${getInlineChatColourByName("white")}rank from ${getInlineChatColourByName("lightGrey")}${oldClanRank.name} ${getInlineChatColourByName("white")}to ${getInlineChatColourByName("lightGrey")}${getClanRankData(clanId, rankId).name}`); + messagePlayerSuccess(client, `You changed {ALTCOLOUR}${getCharacterFullName(targetClient)}'s {MAINCOLOUR}rank from {ALTCOLOUR}${oldClanRank.name} {MAINCOLOUR}to {ALTCOLOUR}${getClanRankData(clanId, rankId).name}`); } // =========================================================================== @@ -1066,7 +1066,7 @@ function showClanFlagListCommand(command, params, client) { let chunkedList = splitArrayIntoChunks(flagList, 10); - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Clan Permissions List ${getInlineChatColourByType("clanOrange")}=====================`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Clan Permissions List {clanOrange}=====================`); for(let i in chunkedList) { messagePlayerInfo(client, chunkedList[i].join(", ")); @@ -1110,7 +1110,7 @@ function showClanFlagListCommand(command, params, client) { let chunkedList = splitArrayIntoChunks(flagList, 10); - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Clan Permissions List ${getInlineChatColourByType("clanOrange")}=====================`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Clan Permissions List {clanOrange}=====================`); for(let i in chunkedList) { messagePlayerInfo(client, chunkedList[i].join(", ")); diff --git a/scripts/server/client.js b/scripts/server/client.js index 32e5eb94..23e681b5 100644 --- a/scripts/server/client.js +++ b/scripts/server/client.js @@ -865,7 +865,7 @@ function playerFinishedSkinSelection(client, allowedSkinIndex) { restorePlayerCamera(client); return false; } else { - getPlayerCurrentSubAccount(client).skin = getSkinIndexFromSkin(allowedSkins[allowedSkinIndex][0]); + getPlayerCurrentSubAccount(client).skin = getSkinIndexFromModel(allowedSkins[allowedSkinIndex][0]); if(isPlayerWorking(client)) { messagePlayerAlert(client, "Your new skin has been saved but won't be shown until you stop working."); setPlayerSkin(client, getJobData(getPlayerCurrentSubAccount(client).job).uniforms[getPlayerData(client).jobUniform].skinId); diff --git a/scripts/server/colour.js b/scripts/server/colour.js index 8c245c08..b04dcadc 100644 --- a/scripts/server/colour.js +++ b/scripts/server/colour.js @@ -26,8 +26,6 @@ let serverColours = { clanOrange: "FF9900", vehiclePurple: "960096", jobYellow: "FFFF00", - ALTCOLOUR: "C8C8C8", - MAINCOLOUR: "FFFFFF", }, byName: { white: "FFFFFF", @@ -305,7 +303,17 @@ function replaceColoursInMessage(messageText) { return ""; } - messageText = messageText.replace("{RESETCOLOUR}", "[/#]"); + let tempFind = `{RESETCOLOUR}`; + let tempRegex = new RegExp(tempFind, 'g'); + messageText = messageText.replace(tempRegex, "[/#]"); + + tempFind = `{ALTCOLOUR}`; + tempRegex = new RegExp(tempFind, 'g'); + messageText = messageText.replace(tempRegex, "[#C8C8C8]"); + + tempFind = `{MAINCOLOUR}`; + tempRegex = new RegExp(tempFind, 'g'); + messageText = messageText.replace(tempRegex, "[#FFFFFF]"); for(let i in getServerColours().hex.byName) { let find = `{${i}}`; diff --git a/scripts/server/command.js b/scripts/server/command.js index 4011b1e0..8a2cdc01 100644 --- a/scripts/server/command.js +++ b/scripts/server/command.js @@ -201,14 +201,13 @@ function loadCommands() { commandData("docmdall", simulateCommandForAllPlayersCommand, " [params]", getStaffFlagValue("developer"), true, true), commandData("addloglvl", addServerLogLevelCommand, "", getStaffFlagValue("developer"), true, true), commandData("delloglvl", removeServerLogLevelCommand, "", getStaffFlagValue("developer"), true, true), + commandData("loglvl", getServerLogLevelCommand, "", getStaffFlagValue("developer"), true, true), - commandData("nosave", togglePauseSavingToDatabase, "", getStaffFlagValue("developer"), true, true), + commandData("nosave", togglePauseSavingToDatabaseCommand, "", getStaffFlagValue("developer"), true, true), commandData("streamurlall", streamAudioURLToAllPlayersCommand, " ", getStaffFlagValue("developer"), true, true), commandData("streamnameall", streamAudioNameToAllPlayersCommand, " ", getStaffFlagValue("developer"), true, true), - //commandData("rumble", streamEventStartToAllPlayersCommand, "", getStaffFlagValue("developer"), true, true), //commandData("forceresetpass", forceAccountPasswordResetCommand, "", getStaffFlagValue("developer"), true, true), - //commandData("loglvl", getServerLogLevelCommand, "", getStaffFlagValue("developer"), true, true), ], discord: [], email: [ @@ -216,6 +215,20 @@ function loadCommands() { ], help: [ commandData("help", helpCommand, "", getStaffFlagValue("none"), false, false), + commandData("commands", helpCommand, "", getStaffFlagValue("none"), false, false), + commandData("cmds", helpCommand, "", getStaffFlagValue("none"), false, false), + commandData("info", helpCommand, "", getStaffFlagValue("none"), false, false), + commandData("veh", helpGetCarCommand, "", getStaffFlagValue("none"), false, false), + commandData("v", helpGetCarCommand, "", getStaffFlagValue("none"), false, false), + commandData("car", helpGetCarCommand, "", getStaffFlagValue("none"), false, false), + commandData("cars", helpGetCarCommand, "", getStaffFlagValue("none"), false, false), + commandData("spawncar", helpGetCarCommand, "", getStaffFlagValue("none"), false, false), + commandData("spawnveh", helpGetCarCommand, "", getStaffFlagValue("none"), false, false), + commandData("skin", helpGetSkinCommand, "", getStaffFlagValue("none"), false, false), + commandData("skins", helpGetSkinCommand, "", getStaffFlagValue("none"), false, false), + commandData("clothes", helpGetSkinCommand, "", getStaffFlagValue("none"), false, false), + commandData("setskin", helpGetSkinCommand, "", getStaffFlagValue("none"), false, false), + commandData("changeskin", helpGetSkinCommand, "", getStaffFlagValue("none"), false, false), ], house: [ commandData("addhouse", createHouseCommand, "", getStaffFlagValue("manageHouses"), true, false), @@ -521,12 +534,12 @@ function disableCommand(command, params, client) { params = toLowerCase(params); if(!getCommand(params)) { - messagePlayerError(client, `The command ${getInlineChatColourByName("lightGrey")}/${params} ${getInlineChatColourByName("white")} does not exist!`); + messagePlayerError(client, `The command {ALTCOLOUR}/${params} {MAINCOLOUR} does not exist!`); return false; } getCommand(params).enabled = false; - messagePlayerSuccess(client, `Command ${getInlineChatColourByName("lightGrey")}/${params} ${getInlineChatColourByName("white")}has been disabled!`); + messagePlayerSuccess(client, `Command {ALTCOLOUR}/${params} {MAINCOLOUR}has been disabled!`); return true; } @@ -541,12 +554,12 @@ function enableCommand(command, params, client) { params = toLowerCase(params); if(!getCommand(params)) { - messagePlayerError(client, `The command ${getInlineChatColourByName("lightGrey")}/${params} ${getInlineChatColourByName("white")} does not exist!`); + messagePlayerError(client, `The command {ALTCOLOUR}/${params} {MAINCOLOUR} does not exist!`); return false; } getCommand(params).enabled = true; - messagePlayerSuccess(client, `Command ${getInlineChatColourByName("lightGrey")}/${params} ${getInlineChatColourByName("white")}has been enabled!`); + messagePlayerSuccess(client, `Command {ALTCOLOUR}/${params} {MAINCOLOUR}has been enabled!`); return true; } @@ -561,7 +574,7 @@ function disableAllCommandsByType(command, params, client) { params = toLowerCase(params); if(isNull(getServerData().commands[params])) { - messagePlayerError(client, `Command type ${getInlineChatColourByName("lightGrey")}${params} ${getInlineChatColourByName("white")}does not exist!`); + messagePlayerError(client, `Command type {ALTCOLOUR}${params} {MAINCOLOUR}does not exist!`); return false; } @@ -569,7 +582,7 @@ function disableAllCommandsByType(command, params, client) { getServerData().commands[params][i].enabled = false; } - messagePlayerSuccess(client, `${getInlineChatColourByType("clanOrange")}All ${getInlineChatColourByName("lightGrey")}${params} ${getInlineChatColourByName("white")}commands have been disabled!`); + messagePlayerSuccess(client, `{clanOrange}All {ALTCOLOUR}${params} {MAINCOLOUR}commands have been disabled!`); return true; } @@ -584,7 +597,7 @@ function enableAllCommandsByType(command, params, client) { params = toLowerCase(params); if(isNull(getServerData().commands[params])) { - messagePlayerError(client, `Command type ${getInlineChatColourByName("lightGrey")}${params} ${getInlineChatColourByName("white")}does not exist!`); + messagePlayerError(client, `Command type {ALTCOLOUR}${params} {MAINCOLOUR}does not exist!`); return false; } @@ -592,7 +605,7 @@ function enableAllCommandsByType(command, params, client) { getServerData().commands[params][i].enabled = true; } - messagePlayerSuccess(client, `${getInlineChatColourByType("clanOrange")}All ${getInlineChatColourByName("lightGrey")}${params} ${getInlineChatColourByName("white")}commands have been enabled!`); + messagePlayerSuccess(client, `{clanOrange}All {ALTCOLOUR}${params} {MAINCOLOUR}commands have been enabled!`); return true; } @@ -618,20 +631,20 @@ function processPlayerCommand(command, params, client) { if(!doesCommandExist(toLowerCase(command))) { console.warn(`[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (invalid command): /${command} ${paramsDisplay}`); - messagePlayerError(client, `The command ${getInlineChatColourByName("lightGrey")}/${command} ${getInlineChatColourByName("white")}does not exist! Use /help for commands and information.`); + messagePlayerError(client, `The command {ALTCOLOUR}/${command} {MAINCOLOUR}does not exist! Use /help for commands and information.`); return false; } if(!commandData.enabled) { console.warn(`[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (command is disabled): /${command} ${paramsDisplay}`); - messagePlayerError(client, `The command ${getInlineChatColourByName("lightGrey")}/${command} ${getInlineChatColourByName("white")}is disabled!`); + messagePlayerError(client, `The command {ALTCOLOUR}/${command} {MAINCOLOUR}is disabled!`); return false; } if(doesCommandRequireLogin(toLowerCase(command))) { if(!isPlayerLoggedIn(client)) { console.warn(`[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (requires login first): /${command} ${paramsDisplay}`); - messagePlayerError(client, `You must be logged in to use the ${getInlineChatColourByName("lightGrey")}/${command} ${getInlineChatColourByName("white")}command!`); + messagePlayerError(client, `You must be logged in to use the {ALTCOLOUR}/${command} {MAINCOLOUR}command!`); return false; } } @@ -639,7 +652,7 @@ function processPlayerCommand(command, params, client) { //if(isClientFromDiscord(client)) { // if(!isCommandAllowedOnDiscord(command)) { // console.warn(`[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command from discord, but failed (not available on discord): /${command} ${paramsDisplay}`); - // messagePlayerError(client, `The ${getInlineChatColourByName("lightGrey")}/${command} ${getInlineChatColourByName("white")} command isn't available on discord!`); + // messagePlayerError(client, `The {ALTCOLOUR}/${command} {MAINCOLOUR} command isn't available on discord!`); // return false; // } //} @@ -647,7 +660,7 @@ function processPlayerCommand(command, params, client) { if(!client.console) { if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(command)))) { console.warn(`[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (no permission): /${command} ${paramsDisplay}`); - messagePlayerError(client, `You do not have permission to use the ${getInlineChatColourByName("lightGrey")}/${toLowerCase(command)} ${getInlineChatColourByName("white")}command!`); + messagePlayerError(client, `You do not have permission to use the {ALTCOLOUR}/${toLowerCase(command)} {MAINCOLOUR}command!`); return false; } } @@ -718,4 +731,4 @@ function getCommandAliasesNames(command) { return commandAliases; } -// =========================================================================== \ No newline at end of file +// =========================================================================== diff --git a/scripts/server/config.js b/scripts/server/config.js index a7cb17a3..b8393b11 100644 --- a/scripts/server/config.js +++ b/scripts/server/config.js @@ -91,6 +91,9 @@ let globalConfig = { "Indian", "Rough", ], + locales: [ + ["English", "english"], + ], }; // =========================================================================== @@ -368,7 +371,7 @@ function setWeatherCommand(command, params, client) { getServerConfig().needsSaved = true; - messageAdminAction(`${getPlayerName(client)} set the weather to ${getInlineChatColourByName("lightGrey")}${getGameData().weatherNames[getServerGame()][toInteger(weatherId)]}`); + messageAdminAction(`${getPlayerName(client)} set the weather to {ALTCOLOUR}${getGameData().weatherNames[getServerGame()][toInteger(weatherId)]}`); updateServerRules(); return true; } diff --git a/scripts/server/const.js b/scripts/server/const.js index 7d312f88..5fcb783b 100644 --- a/scripts/server/const.js +++ b/scripts/server/const.js @@ -219,6 +219,8 @@ const VRR_ITEM_USETYPE_VEHLIVERY = 46; // const VRR_ITEM_USETYPE_VEHREPAIR = 47; // const VRR_ITEM_USETYPE_SMOKEDRUG = 48; // const VRR_ITEM_USETYPE_SNORTDRUG = 49; // +const VRR_ITEM_USETYPE_PLANT = 50; +const VRR_ITEM_USETYPE_MEGAPHONE = 51; // Item Drop Types const VRR_ITEM_DROPTYPE_NONE = 0; // Can't be dropped diff --git a/scripts/server/core.js b/scripts/server/core.js index 08565413..f368bc93 100644 --- a/scripts/server/core.js +++ b/scripts/server/core.js @@ -18,7 +18,6 @@ let serverData = { clients: new Array(128), businesses: [], houses: [], - families: [], factions: [], commands: {}, groundItemCache: [], @@ -30,6 +29,32 @@ let serverData = { whiteListedGameScripts: [], blackListedGameScripts: [], }, + localeStrings: {}, + jobRankNames: [ + [ + "Police Officer I", + "Detective", + "Sergeant", + "Lieutenant", + "Captain", + "Chief of Police", + ], + [ + "Paramedic", + "Senior Paramedic", + "Lieutenant", + "Lieutenant", + "Captain", + "Chief of Department", + ], + [ + "Firefighter", + "Senior Firefighter", + "Fire Marshal", + "Captain", + "Chief of Department", + ] + ] }; // =========================================================================== diff --git a/scripts/server/database.js b/scripts/server/database.js index e5282f04..addc10cd 100644 --- a/scripts/server/database.js +++ b/scripts/server/database.js @@ -170,12 +170,12 @@ function executeDatabaseQueryCommand(command, params, client) { let success = quickDatabaseQuery(params); if(!success) { - messagePlayerAlert(client, `Database query failed to execute: ${getInlineChatColourByName("lightGrey")}${query}`); + messagePlayerAlert(client, `Database query failed to execute: {ALTCOLOUR}${query}`); } else if(typeof success != "boolean") { - messagePlayeSuccess(client, `Database query successful: ${getInlineChatColourByName("lightGrey")}${query}`); + messagePlayeSuccess(client, `Database query successful: {ALTCOLOUR}${query}`); messagePlayerInfo(client, `Returns: ${success}`); } else { - messagePlayerSuccess(client, `Database query successful: ${getInlineChatColourByName("lightGrey")}${query}`); + messagePlayerSuccess(client, `Database query successful: {ALTCOLOUR}${query}`); } return true; } diff --git a/scripts/server/developer.js b/scripts/server/developer.js index 685e0ac1..ee59e4fe 100644 --- a/scripts/server/developer.js +++ b/scripts/server/developer.js @@ -150,7 +150,37 @@ function addServerLogLevelCommand(command, params, client) { return; } - messageAdminAction(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}enabled log level ${getInlineChatColourByName("lightGrey")}${toLowerCase(params)}`); + messageAdminAction(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}enabled log level {ALTCOLOUR}${toLowerCase(params)}`); + + return true; +} + +// =========================================================================== + +function getServerLogLevelCommand(command, params, client) { + let logLevels = []; + + if(hasBitFlag(logLevel, LOG_DEBUG)) { + logLevels.push("debug"); + } + + if(hasBitFlag(logLevel, LOG_WARN)) { + logLevels.push("warn"); + } + + if(hasBitFlag(logLevel, LOG_ERROR)) { + logLevels.push("error"); + } + + if(hasBitFlag(logLevel, LOG_INFO)) { + logLevels.push("info"); + } + + if(hasBitFlag(logLevel, LOG_VERBOSE)) { + logLevels.push("verbose"); + } + + messagePlayerAlert(`{MAINCOLOUR}Current log levels: {ALTCOLOUR}${toLowerCase(logLevels.join(", "))}`); return true; } @@ -188,7 +218,7 @@ function removeServerLogLevelCommand(command, params, client) { return; } - messageAdminAction(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}disabled log level ${getInlineChatColourByName("lightGrey")}${toLowerCase(params)}`); + messageAdminAction(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}disabled log level {ALTCOLOUR}${toLowerCase(params)}`); return true; } @@ -225,12 +255,12 @@ function simulateCommandForPlayerCommand(command, params, client) { } if(!getCommand(tempCommand)) { - messagePlayerError(client, `The command ${getInlineChatColourByName("lightGrey")}/${command} ${getInlineChatColourByName("white")}does not exist! Use /help for commands and information.`); + messagePlayerError(client, `The command {ALTCOLOUR}/${command} {MAINCOLOUR}does not exist! Use /help for commands and information.`); return false; } getCommand(toLowerCase(tempCommand)).handlerFunction(tempCommand, tempParams, targetClient); - messagePlayerSuccess(client, `The command string ${getInlineChatColourByName("lightGrey")}/${tempCommand} ${tempParams}${getInlineChatColourByName("white")} has been simulated for ${getInlineChatColourByName("lightGrey")}${targetgetPlayerName(client)}`); + messagePlayerSuccess(client, `The command string {ALTCOLOUR}/${tempCommand} ${tempParams}{MAINCOLOUR} has been simulated for {ALTCOLOUR}${targetgetPlayerName(client)}`); return true; } @@ -260,7 +290,7 @@ function simulateCommandForAllPlayersCommand(command, params, client) { let tempParams = splitParams.slice(1).join(" "); if(!getCommand(tempCommand)) { - messagePlayerError(client, `The command ${getInlineChatColourByName("lightGrey")}/${command} ${getInlineChatColourByName("white")}does not exist! Use /help for commands and information.`); + messagePlayerError(client, `The command {ALTCOLOUR}/${command} {MAINCOLOUR}does not exist! Use /help for commands and information.`); return false; } @@ -270,7 +300,7 @@ function simulateCommandForAllPlayersCommand(command, params, client) { getCommand(toLowerCase(tempCommand)).handlerFunction(tempCommand, tempParams, clients[i]); } } - messagePlayerSuccess(client, `The command string ${getInlineChatColourByName("lightGrey")}/${tempCommand} ${tempParams}${getInlineChatColourByName("white")} has been simulated for all players!`); + messagePlayerSuccess(client, `The command string {ALTCOLOUR}/${tempCommand} ${tempParams}{MAINCOLOUR} has been simulated for all players!`); return true; } @@ -329,9 +359,9 @@ function executeClientCodeCommand(command, params, client) { // =========================================================================== function saveAllServerDataCommand(command, params, client) { - messageAdmins(`${getInlineChatColourByType("clanOrange")}Vortrex has forced a manual save of all data. Initiating ...`); + messageAdmins(`{clanOrange}Vortrex has forced a manual save of all data. Initiating ...`); saveAllServerDataToDatabase(); - messageAdmins(`${getInlineChatColourByType("clanOrange")}All server data saved to database successfully!`); + messageAdmins(`{clanOrange}All server data saved to database successfully!`); return true; } @@ -345,7 +375,7 @@ function testEmailCommand(command, params, client) { // =========================================================================== function restartGameModeCommand(command, params, client) { - messagePlayerNormal(null, `${getInlineChatColourByType("clanOrange")}The server game mode is restarting!`, getColourByName("orange")); + messagePlayerNormal(null, `{clanOrange}The server game mode is restarting!`, getColourByName("orange")); consoleCommand("refresh"); thisResource.restart(); return true; @@ -465,7 +495,7 @@ function resetAllAccountsHotkeysToDefault() { // =========================================================================== -function togglePauseSavingToDatabase() { +function togglePauseSavingToDatabaseCommand(command, params, client) { getServerConfig().pauseSavingToDatabase = !getServerConfig().pauseSavingToDatabase; } diff --git a/scripts/server/economy.js b/scripts/server/economy.js index f9d0dbcc..4f584669 100644 --- a/scripts/server/economy.js +++ b/scripts/server/economy.js @@ -39,9 +39,9 @@ function playerPayDay(client) { let netIncome = grossIncome-taxAmount; messagePlayerAlert(client, "== Payday! ============================="); - messagePlayerInfo(client, `Paycheck: ${getInlineChatColourByName("lightGrey")}$${grossIncome}`); - messagePlayerInfo(client, `Taxes: ${getInlineChatColourByName("lightGrey")}$${taxAmount}`); - messagePlayerInfo(client, `You receive: ${getInlineChatColourByName("lightGrey")}$${netIncome}`); + messagePlayerInfo(client, `Paycheck: {ALTCOLOUR}$${grossIncome}`); + messagePlayerInfo(client, `Taxes: {ALTCOLOUR}$${taxAmount}`); + messagePlayerInfo(client, `You receive: {ALTCOLOUR}$${netIncome}`); givePlayerCash(client, netIncome); } diff --git a/scripts/server/event.js b/scripts/server/event.js index 9fc62da8..77fe14ab 100644 --- a/scripts/server/event.js +++ b/scripts/server/event.js @@ -51,7 +51,7 @@ function onPlayerConnect(event, ipAddress, port) { // =========================================================================== function onPlayerJoin(event, client) { - logToConsole(LOG_DEBUG, `[VRR.Event] Client ${client.name}[${client.index}] joining from ${ipAddress}`); + logToConsole(LOG_DEBUG, `[VRR.Event] Client ${client.name}[${client.index}] joining from ${client.ip}`); if(isFadeCameraSupported()) { fadeCamera(client, true, 1.0); @@ -89,6 +89,7 @@ function onPlayerQuit(event, client, quitReasonId) { messageDiscordEventChannel(`👋 ${getPlayerDisplayForConsole(client)} has left the server.`); clearTemporaryVehicles(); + clearTemporaryPeds(); } // =========================================================================== @@ -117,7 +118,7 @@ function onPlayerChat(event, client, messageText) { } messageText = messageText.substring(0, 128); - messagePlayerNormal(null, replaceColoursInMessage(`${getInlineChatColourByName("white")}💬 [${hexFromToColour(getPlayerColour(client))}]${getCharacterFullName(client)}: ${getInlineChatColourByName("white")}${messageText}`), getPlayerColour(client)); + messagePlayerNormal(null, replaceColoursInMessage(`{MAINCOLOUR}💬 [${hexFromToColour(getPlayerColour(client))}]${getCharacterFullName(client)}: {MAINCOLOUR}${messageText}`), getPlayerColour(client)); messageDiscordChatChannel(`💬 ${getCharacterFullName(client)}: ${messageText}`); } @@ -149,7 +150,7 @@ function onPedEnteringVehicle(event, ped, vehicle, seat) { if(getVehicleData(vehicle).locked) { if(doesPlayerHaveVehicleKeys(client, vehicle)) { if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "lock")) { - messagePlayerTip(client, `🔒 This ${getVehicleName(vehicle)} is locked. Press ${getInlineChatColourByName("lightGrey")}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "lock").key))} ${getInlineChatColourByName("white")}to unlock it.`); + messagePlayerTip(client, `🔒 This ${getVehicleName(vehicle)} is locked. Press {ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "lock").key))} {MAINCOLOUR}to unlock it.`); } else { messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked. Use /lock to unlock it`); } @@ -185,11 +186,7 @@ function onResourceStart(event, resource) { logToConsole(LOG_WARN, `[VRR.Event] ${resource.name} started!`); if(resource != thisResource) { - messageAdmins(`${getInlineChatColourByName("white")}Resource ${getInlineChatColourByName("lightGrey")}${resource.name} ${getInlineChatColourByName("white")}started!`); - } - - if(resource == thisResource) { - initAllClients(); + messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name} {MAINCOLOUR}started!`); } } @@ -199,11 +196,22 @@ function onResourceStop(event, resource) { logToConsole(LOG_WARN, `[VRR.Event] ${resource.name} stopped!`); if(resource != thisResource) { - messageAdmins(`${getInlineChatColourByName("white")}Resource ${getInlineChatColourByName("lightGrey")}${resource.name} ${getInlineChatColourByName("white")}stopped!`); + messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name} {MAINCOLOUR}stopped!`); } if(resource == thisResource) { saveAllServerDataToDatabase(); + clearArray(getServerData().vehicles); + clearArray(getServerData().clients); + clearArray(getServerData().businesses); + clearArray(getServerData().houses); + clearArray(getServerData().factions); + clearArray(getServerData().jobs); + clearArray(getServerData().clans); + clearArray(getServerData().items); + clearArray(getServerData().itemTypes); + clearArray(getServerData().groundItemCache); + clearArray(getServerData().groundPlantCache); } collectAllGarbage(); @@ -262,16 +270,16 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) { vehicle.engine = getVehicleData(vehicle).engine; if(getVehicleData(vehicle).buyPrice > 0) { - messagePlayerAlert(client, `This ${getVehicleName(vehicle)} is for sale! Cost: ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(getVehicleData(vehicle).buyPrice)}`); + messagePlayerAlert(client, `This ${getVehicleName(vehicle)} is for sale! Cost: {ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).buyPrice)}`); messagePlayerTip(client, `Use /vehbuy if you want to buy it.`); resetVehiclePosition(vehicle); } else if(getVehicleData(vehicle).rentPrice > 0) { if(getVehicleData(vehicle).rentedBy != client) { - messagePlayerAlert(client, `This ${getVehicleName(vehicle)} is for rent! Cost: ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)} per minute`); + messagePlayerAlert(client, `This ${getVehicleName(vehicle)} is for rent! Cost: {ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)} per minute`); messagePlayerTip(client, `Use /vehrent if you want to rent it.`); resetVehiclePosition(vehicle); } else { - messagePlayerAlert(client, `You are renting this ${getVehicleName(vehicle)} for ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)} per minute. ${getInlineChatColourByName("white")}Use ${getInlineChatColourByName("lightGrey")}/stoprent ${getInlineChatColourByName("white")}if you want to stop renting it.`); + messagePlayerAlert(client, `You are renting this ${getVehicleName(vehicle)} for {ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)} per minute. {MAINCOLOUR}Use {ALTCOLOUR}/stoprent {MAINCOLOUR}if you want to stop renting it.`); } } else { let ownerName = "Nobody"; @@ -302,13 +310,13 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) { default: break; } - messagePlayerAlert(client, `This ${getVehicleName(vehicle)} belongs to ${getInlineChatColourByName("lightGrey")}${ownerName} (${ownerType})`); + messagePlayerAlert(client, `This ${getVehicleName(vehicle)} belongs to {ALTCOLOUR}${ownerName} (${ownerType})`); } if(!getVehicleData(vehicle).engine) { if(doesPlayerHaveVehicleKeys(client, vehicle)) { if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "engine")) { - messagePlayerTip(client, `This ${getVehicleName(vehicle)}'s engine is off. Press ${getInlineChatColourByName("lightGrey")}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "engine").key))} ${getInlineChatColourByName("white")}to start it.`); + messagePlayerTip(client, `This ${getVehicleName(vehicle)}'s engine is off. Press {ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "engine").key))} {MAINCOLOUR}to start it.`); } else { messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off. Use /engine to start it`); } @@ -486,7 +494,7 @@ function onPlayerSpawn(client) { getPlayerData(client).ped = client.player; logToConsole(LOG_DEBUG, `[VRR.Event] Sending ${getPlayerDisplayForConsole(client)} the 'now playing as' message`); - messagePlayerAlert(client, `You are now playing as: ${getInlineChatColourByType("businessBlue")}${getCharacterFullName(client)}`, getColourByName("white")); + messagePlayerAlert(client, `You are now playing as: {businessBlue}${getCharacterFullName(client)}`, getColourByName("white")); messagePlayerNormal(client, "This server is in early development and may restart at any time for updates.", getColourByName("orange")); messagePlayerNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow")); diff --git a/scripts/server/help.js b/scripts/server/help.js index 3ff3fda1..b64da70c 100644 --- a/scripts/server/help.js +++ b/scripts/server/help.js @@ -15,34 +15,34 @@ function initHelpScript() { // =========================================================================== let randomTips = [ - `${getInlineChatColourByName("white")}Look for yellow dots on your map for job locations.`, - `${getInlineChatColourByName("white")}You can set custom key binds. Use ${getInlineChatColourByName("lightGrey")}/help keys ${getInlineChatColourByName("white")} for details.`, - `${getInlineChatColourByName("white")}Use /notips if you don't want to see tips and extra information`, - `${getInlineChatColourByName("white")}You can edit your keybinds using ${getInlineChatColourByName("lightGrey")}/bindkey and /unbindkey`, - `${getInlineChatColourByName("white")}Press ℹ️ to see your inventory, and use number keys to select an item`, - `${getInlineChatColourByName("white")}Use /buy at a business to purchase items.`, - `${getInlineChatColourByName("white")}Found a bug? Report it with ${getInlineChatColourByName("lightGrey")}/bug`, - `${getInlineChatColourByName("white")}Have an idea or suggestion for the server? Let the devs know using ${getInlineChatColourByName("lightGrey")}/idea`, - `${getInlineChatColourByName("white")}Want to buy a business? Use /bizbuy at one for sale`, - `${getInlineChatColourByName("white")}Want to buy a house? Use /housebuy at one for sale`, - `${getInlineChatColourByName("white")}Want to buy a vehicle? Visit a dealership and enter one for info on how to buy it!`, - `${getInlineChatColourByName("white")}Switch to any of your characters with ${getInlineChatColourByName("lightGrey")}/switchchar`, - `${getInlineChatColourByName("white")}Use ${getInlineChatColourByName("lightGrey")}/iplogin ${getInlineChatColourByName("white")}to automatically login when connecting with the same IP`, - `${getInlineChatColourByName("white")}Use ${getInlineChatColourByName("lightGrey")}/houselights or /bizlights ${getInlineChatColourByName("white")}to turn on/off the lights in your house or business`, - `${getInlineChatColourByName("white")}Use ${getInlineChatColourByName("lightGrey")}/radiostation ${getInlineChatColourByName("white")}to play an internet radio station in your car, house, or business`, - //`${getInlineChatColourByName("white")}Lower your car windows with /windows ${getInlineChatColourByName("lightGrey")} to play the vehicle's internet radio station ${getInlineChatColourByName("lightGrey")}(/radiostation) ${getInlineChatColourByName("white")}to nearby players`, - //`${getInlineChatColourByName("white")}Lower your car windows with /windows ${getInlineChatColourByName("lightGrey")} to play the vehicle's internet radio station ${getInlineChatColourByName("lightGrey")}(/radiostation) ${getInlineChatColourByName("white")}to nearby players`, - //`${getInlineChatColourByName("white")}Tax is based on your total wealth. This includes money, vehicles, businesses and more.`, - //`${getInlineChatColourByName("white")}Don't go broke because of a hospital bill! Get insured today by visiting an insurance agency!`, - //`${getInlineChatColourByName("white")}Don't go broke because your car was destroyed. Visit an insurance agency today!`, - //`${getInlineChatColourByName("white")}You can find most locations by using ${getInlineChatColourByName("lightGrey")}/gps`, - //`${getInlineChatColourByName("white")}Want to advertise your business? Visit the news station and place an /ad today!`, - //`${getInlineChatColourByName("white")}You can change your quick item display. Choices are GTAV-style pie menu or Minecraft-style hotbar`, - //`${getInlineChatColourByName("white")}Hold [#0066FF]E ${getInlineChatColourByName("white")}to hail a nearby taxi if you need a ride.`, - //`${getInlineChatColourByName("white")}Press [#0066FF]G ${getInlineChatColourByName("white")}to enter a vehicle as passenger.`, - //`${getInlineChatColourByName("white")}Banks can provide loans. Use ${getInlineChatColourByName("lightGrey")}/help loans ${getInlineChatColourByName("white")} for more details.`, - `${getInlineChatColourByName("white")}Want to make a clan? Use ${getInlineChatColourByName("lightGrey")}/help clans ${getInlineChatColourByName("white")} for details.`, - `${getInlineChatColourByName("white")}Legal weapons can be purchased at any ammunation.`, + `{MAINCOLOUR}Look for yellow dots on your map for job locations.`, + `{MAINCOLOUR}You can set custom key binds. Use {ALTCOLOUR}/help keys {MAINCOLOUR} for details.`, + `{MAINCOLOUR}Use /notips if you don't want to see tips and extra information`, + `{MAINCOLOUR}You can edit your keybinds using {ALTCOLOUR}/bindkey and /unbindkey`, + `{MAINCOLOUR}Press ℹ️ to see your inventory, and use number keys to select an item`, + `{MAINCOLOUR}Use /buy at a business to purchase items.`, + `{MAINCOLOUR}Found a bug? Report it with {ALTCOLOUR}/bug`, + `{MAINCOLOUR}Have an idea or suggestion for the server? Let the devs know using {ALTCOLOUR}/idea`, + `{MAINCOLOUR}Want to buy a business? Use /bizbuy at one for sale`, + `{MAINCOLOUR}Want to buy a house? Use /housebuy at one for sale`, + `{MAINCOLOUR}Want to buy a vehicle? Visit a dealership and enter one for info on how to buy it!`, + `{MAINCOLOUR}Switch to any of your characters with {ALTCOLOUR}/switchchar`, + `{MAINCOLOUR}Use {ALTCOLOUR}/iplogin {MAINCOLOUR}to automatically login when connecting with the same IP`, + `{MAINCOLOUR}Use {ALTCOLOUR}/houselights or /bizlights {MAINCOLOUR}to turn on/off the lights in your house or business`, + `{MAINCOLOUR}Use {ALTCOLOUR}/radiostation {MAINCOLOUR}to play an internet radio station in your car, house, or business`, + //`{MAINCOLOUR}Lower your car windows with /windows {ALTCOLOUR} to play the vehicle's internet radio station {ALTCOLOUR}(/radiostation) {MAINCOLOUR}to nearby players`, + //`{MAINCOLOUR}Lower your car windows with /windows {ALTCOLOUR} to play the vehicle's internet radio station {ALTCOLOUR}(/radiostation) {MAINCOLOUR}to nearby players`, + //`{MAINCOLOUR}Tax is based on your total wealth. This includes money, vehicles, businesses and more.`, + //`{MAINCOLOUR}Don't go broke because of a hospital bill! Get insured today by visiting an insurance agency!`, + //`{MAINCOLOUR}Don't go broke because your car was destroyed. Visit an insurance agency today!`, + //`{MAINCOLOUR}You can find most locations by using {ALTCOLOUR}/gps`, + //`{MAINCOLOUR}Want to advertise your business? Visit the news station and place an /ad today!`, + //`{MAINCOLOUR}You can change your quick item display. Choices are GTAV-style pie menu or Minecraft-style hotbar`, + //`{MAINCOLOUR}Hold [#0066FF]E {MAINCOLOUR}to hail a nearby taxi if you need a ride.`, + //`{MAINCOLOUR}Press [#0066FF]G {MAINCOLOUR}to enter a vehicle as passenger.`, + //`{MAINCOLOUR}Banks can provide loans. Use {ALTCOLOUR}/help loans {MAINCOLOUR} for more details.`, + `{MAINCOLOUR}Want to make a clan? Use {ALTCOLOUR}/help clans {MAINCOLOUR} for details.`, + `{MAINCOLOUR}Legal weapons can be purchased at any ammunation.`, ]; // =========================================================================== @@ -170,153 +170,154 @@ function helpCommand(command, params, client) { // == Admins =================================== // == Badge ==================================== // == Accents ================================== +// == Player Info ============================== // =========================================================================== function showMainHelpMessage(client) { - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Help ${getInlineChatColourByType("clanOrange")}=================================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Use /help for commands and info. Example: ${getInlineChatColourByName("lightGrey")}/help vehicle`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Help Categories: [#A9A9A9]account, command, vehicle, job, chat, rules, website, anim`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• [#A9A9A9]ammunation, skins, mechanic, dealership, discord, colours, keys`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Help {clanOrange}=================================`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use /help for commands and info. Example: {ALTCOLOUR}/help vehicle`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Help Categories: [#A9A9A9]account, command, vehicle, job, chat, rules, website, anim`); + messagePlayerNormal(client, `{clanOrange}• [#A9A9A9]ammunation, skins, mechanic, dealership, discord, colours, keys`); } // =========================================================================== function showAccountHelpMessage(client) { - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Account Help ${getInlineChatColourByType("clanOrange")}=============================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Do not share your password with anybody else.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Use ${getInlineChatColourByName("lightGrey")}/changepass${getInlineChatColourByName("white")} to change your password.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Some settings you can use: ${getInlineChatColourByName("lightGrey")}/gui, /logo, /iplogin, /autolastchar, /2fa, /loginalert`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Account Help {clanOrange}=============================`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Do not share your password with anybody else.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use {ALTCOLOUR}/changepass{MAINCOLOUR} to change your password.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some settings you can use: {ALTCOLOUR}/gui, /logo, /iplogin, /autolastchar, /2fa, /loginalert`); } // =========================================================================== function showVehicleHelpMessage(client) { - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Vehicle Help ${getInlineChatColourByType("clanOrange")}=============================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Visit dealerships to buy new vehicles (Use ${getInlineChatColourByName("lightGrey")}/help dealership ${getInlineChatColourByName("white")}for more info.)`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Some commands: ${getInlineChatColourByName("lightGrey")}/lock, /engine, /lights, /trunk, /rentveh, /buyveh, /rentprice, /buyprice`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Your personal vehicles will save wherever you or somebody else leaves them!`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Visit a mechanic garage to repair, colour, and tune up your car! ${getInlineChatColourByName("lightGrey")}/help mechanic ${getInlineChatColourByName("white")} for info`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Don't forget to register and insure your vehicle! Use ${getInlineChatColourByName("lightGrey")}/gps ${getInlineChatColourByName("white")}to find a DMV for this.`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Vehicle Help {clanOrange}=============================`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit dealerships to buy new vehicles (Use {ALTCOLOUR}/help dealership {MAINCOLOUR}for more info.)`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some commands: {ALTCOLOUR}/lock, /engine, /lights, /trunk, /rentveh, /buyveh, /rentprice, /buyprice`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Your personal vehicles will save wherever you or somebody else leaves them!`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit a mechanic garage to repair, colour, and tune up your car! {ALTCOLOUR}/help mechanic {MAINCOLOUR} for info`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Don't forget to register and insure your vehicle! Use {ALTCOLOUR}/gps {MAINCOLOUR}to find a DMV for this.`); } // =========================================================================== function showVehicleDealershipHelpMessage(client) { - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Vehicle Dealerships ${getInlineChatColourByType("clanOrange")}======================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Visit a vehicle dealer to buy new vehicles. Use ${getInlineChatColourByName("lightGrey")}/gps ${getInlineChatColourByName("white")}to find one.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}At the dealer, simply enter a car you want to buy, and the price will be shown to you`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}If you want to buy the vehicle and have enough money, use ${getInlineChatColourByName("lightGrey")}/buyveh ${getInlineChatColourByName("white")}and you will be given keys`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}A new car for sale will appear when you drive away from the dealer.`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Vehicle Dealerships {clanOrange}======================`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit a vehicle dealer to buy new vehicles. Use {ALTCOLOUR}/gps {MAINCOLOUR}to find one.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}At the dealer, simply enter a car you want to buy, and the price will be shown to you`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}If you want to buy the vehicle and have enough money, use {ALTCOLOUR}/buyveh {MAINCOLOUR}and you will be given keys`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}A new car for sale will appear when you drive away from the dealer.`); } // =========================================================================== function showJobHelpMessage(client) { - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Job Help ${getInlineChatColourByType("clanOrange")}=================================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Visit job locations get a job and earn money. Look for yellow spots on the map`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}At a job location, use ${getInlineChatColourByName("lightGrey")}/takejob ${getInlineChatColourByName("white")}to get the job. Use ${getInlineChatColourByName("lightGrey")}/quitjob ${getInlineChatColourByName("white")}to quit your job`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Use ${getInlineChatColourByName("lightGrey")}/startwork ${getInlineChatColourByName("white")}to begin working. You can also get a job ${getInlineChatColourByName("lightGrey")}/uniform and ${getInlineChatColourByName("lightGrey")}/equipment`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Most job vehicles are locked. Use ${getInlineChatColourByName("lightGrey")}/lock ${getInlineChatColourByName("white")}near one to enter it.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}When entering a job vehicle, information on how to do the job will be shown to you.`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Job Help {clanOrange}=================================`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit job locations get a job and earn money. Look for yellow spots on the map`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}At a job location, use {ALTCOLOUR}/takejob {MAINCOLOUR}to get the job. Use {ALTCOLOUR}/quitjob {MAINCOLOUR}to quit your job`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use {ALTCOLOUR}/startwork {MAINCOLOUR}to begin working. You can also get a job {ALTCOLOUR}/uniform and {ALTCOLOUR}/equipment`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Most job vehicles are locked. Use {ALTCOLOUR}/lock {MAINCOLOUR}near one to enter it.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}When entering a job vehicle, information on how to do the job will be shown to you.`); } // =========================================================================== function showChatHelpMessage(client) { - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Chat Help ${getInlineChatColourByType("clanOrange")}================================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}There are two main types of chat: out-of-character (OOC) and in-character (IC)`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Mixing these two types is not proper roleplay. See ${getInlineChatColourByName("lightGrey")}/rules ${getInlineChatColourByName("white")}for info.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Some chat commands: ${getInlineChatColourByName("lightGrey")}/dm /whisper /talk /shout /me.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Some have shorter names available (${getInlineChatColourByName("lightGrey")}/t ${getInlineChatColourByName("white")}for talk, ${getInlineChatColourByName("lightGrey")}/s ${getInlineChatColourByName("white")}for shout, etc)`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Chat Help {clanOrange}================================`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}There are two main types of chat: out-of-character (OOC) and in-character (IC)`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Mixing these two types is not proper roleplay. See {ALTCOLOUR}/rules {MAINCOLOUR}for info.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some chat commands: {ALTCOLOUR}/dm /whisper /talk /shout /me.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some have shorter names available ({ALTCOLOUR}/t {MAINCOLOUR}for talk, {ALTCOLOUR}/s {MAINCOLOUR}for shout, etc)`); } // =========================================================================== function showRulesHelpMessage(client) { - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Server Rules ${getInlineChatColourByType("clanOrange")}=============================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Unrealistic actions (powergaming) are not allowed. You aren't superman.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}No terrorist or terrorism roleplay is allowed.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Always follow instructions given by moderators and admins.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Do not mix the chats (metagaming). You can't use info in IC that was received OOC`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Keep English in main chats. If you aren't good at English, use ${getInlineChatColourByName("lightGrey")}/help language`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Server Rules {clanOrange}=============================`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Unrealistic actions (powergaming) are not allowed. You aren't superman.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}No terrorist or terrorism roleplay is allowed.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Always follow instructions given by moderators and admins.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Do not mix the chats (metagaming). You can't use info in IC that was received OOC`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Keep English in main chats. If you aren't good at English, use {ALTCOLOUR}/help language`); } // =========================================================================== function showWebsiteHelpMessage(client) { - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Website ${getInlineChatColourByType("clanOrange")}=============================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}${server.getCVar("Website")}`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Website {clanOrange}=============================`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${server.getCVar("Website")}`); } // =========================================================================== function showDiscordHelpMessage(client) { - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Discord ${getInlineChatColourByType("clanOrange")}=============================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}${server.getCVar("Discord")}`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Discord {clanOrange}=============================`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${server.getCVar("Discord")}`); } // =========================================================================== function showAnimationHelpMessage(client) { - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Animations ${getInlineChatColourByType("clanOrange")}===============================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Animations allow you to enhance roleplay with visual actions`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Use ${getInlineChatColourByName("lightGrey")}/an ${getInlineChatColourByName("white")}or ${getInlineChatColourByName("lightGrey")}/anim ${getInlineChatColourByName("white")}with a name to use an animation.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}To see a list of animations, use ${getInlineChatColourByName("lightGrey")}/animlist`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Animations {clanOrange}===============================`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Animations allow you to enhance roleplay with visual actions`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use {ALTCOLOUR}/an {MAINCOLOUR}or {ALTCOLOUR}/anim {MAINCOLOUR}with a name to use an animation.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}To see a list of animations, use {ALTCOLOUR}/animlist`); } // =========================================================================== function showAmmunationHelpMessage(client) { - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Ammunation ${getInlineChatColourByType("clanOrange")}===============================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Visit an ammunation to buy weapons. Use ${getInlineChatColourByName("lightGrey")}/gps ${getInlineChatColourByName("white")}to find one.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Buying a weapon requires a weapon license.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Weapon licenses are managed by the police department. Apply there to get one.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Weapons can also be purchased illegally from weapon dealers and clans.`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Ammunation {clanOrange}===============================`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit an ammunation to buy weapons. Use {ALTCOLOUR}/gps {MAINCOLOUR}to find one.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Buying a weapon requires a weapon license.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Weapon licenses are managed by the police department. Apply there to get one.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Weapons can also be purchased illegally from weapon dealers and clans.`); } // =========================================================================== function showClothesHelpMessage(client) { - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Clothes ${getInlineChatColourByType("clanOrange")}==================================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}To change your skin, use ${getInlineChatColourByName("lightGrey")}/gps ${getInlineChatColourByName("white")}to find a clothing store`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}At a clothing store, use ${getInlineChatColourByName("lightGrey")}/buy ${getInlineChatColourByName("white")} to purchase clothes`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}When you have a clothing item, equip and use it like any other item to show the skin selection. Check ${getInlineChatColourByName("lightGrey")}(/help items) ${getInlineChatColourByName("white")}to learn how to use items)`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Some skins are restricted to jobs, clans, or for other reasons.`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Clothes {clanOrange}==================================`); + //messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}To change your skin, use {ALTCOLOUR}/gps {MAINCOLOUR}to find a clothing store`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}At a clothing store, use {ALTCOLOUR}/buy {MAINCOLOUR} to purchase clothes`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}When you have a clothing item, equip and use it like any other item to show the skin selection (check {ALTCOLOUR}/help items {MAINCOLOUR}to learn how to use items)`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some skins are restricted to jobs, clans, or for other reasons.`); } // =========================================================================== function showBindKeysHelpMessage(client) { - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Bindable Keys ${getInlineChatColourByType("clanOrange")}============================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}You can set your own keys binds. Use ${getInlineChatColourByName("lightGrey")}/keybinds ${getInlineChatColourByName("white")}to see your binded keys.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Use ${getInlineChatColourByName("lightGrey")}/bindkey ${getInlineChatColourByName("white")}to add a new keybind and /unbindkey to remove one.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Default keys are: [#0066FF]K ${getInlineChatColourByName("white")}for vehicle engine, [#0066FF]L ${getInlineChatColourByName("white")}for lights, and [#0066FF]J ${getInlineChatColourByName("white")}for lock/unlock`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}[#0066FF]I ${getInlineChatColourByName("white")}to see your items and [#0066FF]1-9 ${getInlineChatColourByName("white")}to equip an item or [#0066FF]0 (zero) ${getInlineChatColourByName("white")}to equip none.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}[#0066FF]U ${getInlineChatColourByName("white")}to use or [#0066FF]O ${getInlineChatColourByName("white")}to drop your current item, and [#0066FF]P ${getInlineChatColourByName("white")}to pickup an item from the ground.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}[#0066FF]M ${getInlineChatColourByName("white")}for mouse cam (free look)`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Your keybinds will automatically be usable on all ${getServerName()} servers`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Bindable Keys {clanOrange}============================`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}You can set your own keys binds. Use {ALTCOLOUR}/keybinds {MAINCOLOUR}to see your binded keys.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use {ALTCOLOUR}/bindkey {MAINCOLOUR}to add a new keybind and /unbindkey to remove one.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Default keys are: [#0066FF]K {MAINCOLOUR}for vehicle engine, [#0066FF]L {MAINCOLOUR}for lights, and [#0066FF]J {MAINCOLOUR}for lock/unlock`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}[#0066FF]I {MAINCOLOUR}to see your items and [#0066FF]1-9 {MAINCOLOUR}to equip an item or [#0066FF]0 (zero) {MAINCOLOUR}to equip none.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}[#0066FF]U {MAINCOLOUR}to use or [#0066FF]O {MAINCOLOUR}to drop your current item, and [#0066FF]P {MAINCOLOUR}to pickup an item from the ground.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}[#0066FF]M {MAINCOLOUR}for mouse cam (free look)`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Your keybinds will automatically be usable on all ${getServerName()} servers`); } // =========================================================================== function showBusinessHelpMessage(client) { - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Business ${getInlineChatColourByType("clanOrange")}=================================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Use /buy to purchase items or /bizitems to see a list of what's for sale at any business`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Businesses are shown with blue names above the icon at their entrance.`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Business owner commands: ${getInlineChatColourByName("lightGrey")}/bizorder, /biz`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}A new car for sale will appear when you drive away from the dealer.`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Business {clanOrange}=================================`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use /buy to purchase items or /bizitems to see a list of what's for sale at any business`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Businesses are shown with blue names above the icon at their entrance.`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Business owner commands: {ALTCOLOUR}/bizorder, /biz`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}A new car for sale will appear when you drive away from the dealer.`); } // =========================================================================== function showClanHelpMessage(client) { - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Clan ${getInlineChatColourByType("clanOrange")}================================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Use ${getInlineChatColourByName("lightGrey")}/addclan ${getInlineChatColourByName("white")}to create a clan (Similar to factions/groups/families)`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Clan commands: ${getInlineChatColourByName("lightGrey")}/clan, /clanmotd, /clanname, /clanowner, /clanhouse, /clanbiz, /claninvite, /clanuninvite, /clansetrank`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}${getInlineChatColourByName("lightGrey")}/clanflags, /clanaddrank, /clandelrank, /clanaddrankflag, /clandelrankflag, /clanaddmemberflag, /clandelmemberflag`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}${getInlineChatColourByName("lightGrey")}/clanranks, /clanaddrank, /clandelrank, /clanrankname, /clanaddrankflag, /clandelrankflag`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}${getInlineChatColourByName("lightGrey")}/clanaddmemberflag, /clandelmemberflag`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Clan {clanOrange}================================`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use {ALTCOLOUR}/addclan {MAINCOLOUR}to create a clan (Similar to factions/groups/families)`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Clan commands: {ALTCOLOUR}/clan, /clanmotd, /clanname, /clanowner, /clanhouse, /clanbiz, /claninvite, /clanuninvite, /clansetrank`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}{ALTCOLOUR}/clanflags, /clanaddrank, /clandelrank, /clanaddrankflag, /clandelrankflag, /clanaddmemberflag, /clandelmemberflag`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}{ALTCOLOUR}/clanranks, /clanaddrank, /clandelrank, /clanrankname, /clanaddrankflag, /clandelrankflag`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}{ALTCOLOUR}/clanaddmemberflag, /clandelmemberflag`); } // =========================================================================== @@ -337,95 +338,50 @@ function showCommandHelpMessage(client, commandName) { let command = getCommandData(commandName); let aliases = getCommandAliasesNames(command); - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Command Info ${getInlineChatColourByType("clanOrange")}=============================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Description: ${command.description}`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Command Info {clanOrange}=============================`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Description: ${command.description}`); if(aliases.length > 0) { - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Aliases: ${aliases.join(", ")}`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: ${aliases.join(", ")}`); } else { - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Aliases: (None)`); + messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: (None)`); } - //messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Usable on Discord: ${getYesNoFromBool(command.allowOnDiscord)}`); + //messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Usable on Discord: ${getYesNoFromBool(command.allowOnDiscord)}`); //if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("basicModeration"))) { - // messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}• ${getInlineChatColourByName("white")}Usable on Discord: ${getYesNoFromBool(command.allowOnDiscord)}`); + // messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}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.`); - getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.enteredDriverSeat; - } +/** + * 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 helpGetCarCommand(command, params, client) { + messagePlayerAlert(client, `You can buy a car by visiting a vehicle dealership. Use {ALTCOLOUR}/help vehicle {MAINCOLOUR}for more info.`); } // =========================================================================== -function showApproachJobWhileUnemployedTip(client) { - if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachJobWhileUnemployed) { - messagePlayerTip(client, `Approach the icon and use /jobinfo to see details about this job.`); - getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.approachJobWhileUnemployed; - } -} - -// =========================================================================== - -function showTakeNearbyJobTip(client) { - if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.takeJobWhileUnemployed) { - messagePlayerTip(client, `You are nearby a job location. Look for the spinning icon.`); - getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.takeJobWhileUnemployed; - } -} - -// =========================================================================== - -function showApproachCurrentJobTip(client) { - if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachCurrentJob) { - //messagePlayerTip(client, `Press ${getServerConfig().keybindText.actionKey} to start working, or hold ${getServerConfig().keybindText.actionKey} to quit your job.`); - messagePlayerTip(client, `This job location is for your job. You can use /startwork to start working.`); - getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.approachCurrentJob; - } -} - -// =========================================================================== - -function showApproachOtherJobTip(client) { - if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachCurrentJob) { - //messagePlayerTip(client, `Press ${getServerConfig().keybindText.actionKey} to start working, or hold ${getServerConfig().keybindText.actionKey} to quit your job.`); - messagePlayerTip(client, `This job location belongs to another job. If you want this job, use /quitjob first.`); - getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.approachCurrentJob; - } -} - -// =========================================================================== - -function showStartedWorkingTip(client) { - if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.startedWorking) { - //messagePlayerTip(client, `Press ${getServerConfig().keybindText.actionKey} to change uniform, or hold ${getServerConfig().keybindText.actionKey} to stop working.`); - messagePlayerTip(client, `Use /uniform to see job skins and /equip to see available jobs tools and weapons.`); - getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.startedWorking; - } -} - -// =========================================================================== - -function showApproachOwnedVehicleTip(client) { - if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachOwnedVehicle) { - messagePlayerTip(client, `This vehicle is owned by you.`); - getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.approachOwnedVehicle; - } -} - -// =========================================================================== - -function showApproachClanVehicleTip(client) { - if(getPlayerData(client).accountData.shownTips & !shownTipsFlags.approachAnyVehicle) { - messagePlayerTip(client, `Your clan owns this vehicle.`); - getPlayerData(client).accountData.shownTips = getPlayerData(client).accountData.shownTips | shownTipsFlags.approachAnyVehicle; - } +/** + * 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 helpGetSkinCommand(command, params, client) { + messagePlayerAlert(client, `You can change your skin by visiting a clothes store. Use {ALTCOLOUR}/help skin {MAINCOLOUR}for more info.`); } // =========================================================================== \ No newline at end of file diff --git a/scripts/server/house.js b/scripts/server/house.js index 1cbb15d3..912a8820 100644 --- a/scripts/server/house.js +++ b/scripts/server/house.js @@ -90,7 +90,7 @@ function createHouseCommand(command, params, client) { //getHouseData(houseId).needsSaved = true; - let messageText = `${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}created house ${getInlineChatColourByType("houseGreen")}${tempHouseData.description}`; + let messageText = `{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}created house {houseGreen}${tempHouseData.description}`; logToConsole(LOG_INFO, messageText); messageAdmins(messageText); } @@ -125,7 +125,7 @@ function lockUnlockHouseCommand(command, params, client) { setEntityData(getHouseData(houseId).entrancePickup, "vrr.label.locked", getHouseData(houseId).locked, true); getHouseData(houseId).needsSaved = true; - messagePlayerSuccess(client, `House ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}${getLockedUnlockedTextFromBool((getHouseData(houseId).locked))}!`); + messagePlayerSuccess(client, `House {houseGreen}${getHouseData(houseId).description} {MAINCOLOUR}${getLockedUnlockedTextFromBool((getHouseData(houseId).locked))}!`); } // =========================================================================== @@ -189,7 +189,7 @@ function setHouseDescriptionCommand(command, params, client) { getHouseData(houseId).needsSaved = true; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}renamed house ${getInlineChatColourByType("houseGreen")}${oldDescription} ${getInlineChatColourByName("white")}to ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}renamed house {houseGreen}${oldDescription} {MAINCOLOUR}to {houseGreen}${getHouseData(houseId).description}`); } // =========================================================================== @@ -228,7 +228,7 @@ function setHouseOwnerCommand(command, params, client) { getHouseData(houseId).ownerType = VRR_HOUSEOWNER_PLAYER; getHouseData(houseId).ownerId = getServerData().clients[newHouseOwner.index].accountData.databaseId; - messagePlayerSuccess(`${getInlineChatColourByName("white")}You gave house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}to ${getInlineChatColourByName("lightGrey")}${newHouseOwner.name}`); + messagePlayerSuccess(`{MAINCOLOUR}You gave house {houseGreen}${getHouseData(houseId).description} {MAINCOLOUR}to {ALTCOLOUR}${newHouseOwner.name}`); } // =========================================================================== @@ -268,7 +268,7 @@ function setHouseClanCommand(command, params, client) { getHouseData(houseId).ownerType = VRR_HOUSEOWNER_CLAN; getHouseData(houseId).ownerId = getClanData(clanId).databaseId; - messagePlayerSuccess(`${getInlineChatColourByName("white")}You gave house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")} to the ${getInlineChatColourByType("clanOrange")}${getClanData(clanId).name} ${getInlineChatColourByName("white")}clan!`); + messagePlayerSuccess(`{MAINCOLOUR}You gave house {houseGreen}${getHouseData(houseId).description} {MAINCOLOUR} to the {clanOrange}${getClanData(clanId).name} {MAINCOLOUR}clan!`); } // =========================================================================== @@ -316,7 +316,7 @@ function setHouseClanCommand(command, params, client) { getHouseData(houseId).clanRank = getClanRankData(clanId, clanRankId).level; getHouseData(houseId).needsSaved = true; - messagePlayerSuccess(`${getInlineChatColourByName("white")}You set house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description}${getInlineChatColourByName("white")}'s clan rank to ${getInlineChatColourByType("clanOrange")}${getClanRankData(clanId, clanRankId).name} ${getInlineChatColourByName("white")}(level ${getClanRankData(clanId, clanRankId).level}) and above!`); + messagePlayerSuccess(`{MAINCOLOUR}You set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR}'s clan rank to {clanOrange}${getClanRankData(clanId, clanRankId).name} {MAINCOLOUR}(level ${getClanRankData(clanId, clanRankId).level}) and above!`); } // =========================================================================== @@ -391,13 +391,13 @@ function setHouseInteriorTypeCommand(command, params, client) { tempHouseLocation.exitPosition = toVector3(0.0, 0.0, 0.0); tempHouseLocation.exitInterior = -1; getHouseData(houseId).hasInterior = false; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}removed house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}interior`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}removed house {houseGreen}${getHouseData(houseId).description} {MAINCOLOUR}interior`); return false; } if(isNull(getGameConfig().interiorTemplates[getServerGame()][typeParam])) { messagePlayerError(client, "Invalid interior type! Use an interior type name"); - messagePlayerInfo(client, `Interior Types: ${getInlineChatColourByName("lightGrey")}${Object.keys(getGameConfig().interiorTemplates[getServerGame()]).join(", ")}`) + messagePlayerInfo(client, `Interior Types: {ALTCOLOUR}${Object.keys(getGameConfig().interiorTemplates[getServerGame()]).join(", ")}`) return false; } @@ -496,7 +496,7 @@ function moveHouseEntranceCommand(command, params, client) { getHouseData(houseId).needsSaved = true; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}moved house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}entrance to their position`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}moved house {houseGreen}${getHouseData(houseId).description} {MAINCOLOUR}entrance to their position`); } // =========================================================================== @@ -536,7 +536,7 @@ function moveHouseExitCommand(command, params, client) { getHouseData(houseId).needsSaved = true; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}moved house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}exit to their position`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}moved house {houseGreen}${getHouseData(houseId).description} {MAINCOLOUR}exit to their position`); } // =========================================================================== @@ -558,7 +558,7 @@ function deleteHouseCommand(command, params, client) { return false; } - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}deleted house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}deleted house {houseGreen}${getHouseData(houseId).description}`); deleteHouse(houseId, getPlayerData(client).accountData.databaseId); } @@ -1005,7 +1005,7 @@ function getHouseInfoCommand(command, params, client) { break; } - messagePlayerNormal(client, `🏠 ${getInlineChatColourByType("houseGreen")}[House Info] ${getInlineChatColourByName("white")}Description: ${getInlineChatColourByName("lightGrey")}${getHouseData(houseId).description}, ${getInlineChatColourByName("white")}Owner: ${getInlineChatColourByName("lightGrey")}${ownerName} (${getHouseOwnerTypeText(getHouseData(houseId).ownerType)}), ${getInlineChatColourByName("white")}Locked: ${getInlineChatColourByName("lightGrey")}${getYesNoFromBool(intToBool(getHouseData(houseId).locked))}, ${getInlineChatColourByName("white")}ID: ${getInlineChatColourByName("lightGrey")}${houseId}/${getHouseData(houseId).databaseId}`); + messagePlayerNormal(client, `🏠 {houseGreen}[House Info] {MAINCOLOUR}Description: {ALTCOLOUR}${getHouseData(houseId).description}, {MAINCOLOUR}Owner: {ALTCOLOUR}${ownerName} (${getHouseOwnerTypeText(getHouseData(houseId).ownerType)}), {MAINCOLOUR}Locked: {ALTCOLOUR}${getYesNoFromBool(intToBool(getHouseData(houseId).locked))}, {MAINCOLOUR}ID: {ALTCOLOUR}${houseId}/${getHouseData(houseId).databaseId}`); } // =========================================================================== @@ -1033,7 +1033,7 @@ function setHouseBuyPriceCommand(command, params, client) { getHouseData(houseId).buyPrice = amount; setEntityData(getHouseData(houseId).entrancePickup, "vrr.label.price", getHouseData(houseId).buyPrice, true); - messagePlayerSuccess(client, `${getInlineChatColourByName("white")}You set house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description}'s ${getInlineChatColourByName("white")}for-sale price to ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(amount)}`); + messagePlayerSuccess(client, `{MAINCOLOUR}You set house {houseGreen}${getHouseData(houseId).description}'s {MAINCOLOUR}for-sale price to {ALTCOLOUR}$${makeLargeNumberReadable(amount)}`); } // =========================================================================== @@ -1061,7 +1061,7 @@ function setHouseRentPriceCommand(command, params, client) { getHouseData(houseId).rentPrice = amount; setEntityData(getHouseData(houseId).entrancePickup, "vrr.label.price", `Rent: ${getHouseData(houseId).rentPrice}`, true); - messagePlayerSuccess(client, `${getInlineChatColourByName("white")}You set house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description}'s ${getInlineChatColourByName("white")}rent price to ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(amount)}`); + messagePlayerSuccess(client, `{MAINCOLOUR}You set house {houseGreen}${getHouseData(houseId).description}'s {MAINCOLOUR}rent price to {ALTCOLOUR}$${makeLargeNumberReadable(amount)}`); } // =========================================================================== @@ -1075,12 +1075,12 @@ function buyHouseCommand(command, params, client) { } if(getHouseData(houseId).buyPrice <= 0) { - messagePlayerError(client, `${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("white")}is not for sale!`); + messagePlayerError(client, `{houseGreen}${getHouseData(houseId).description} {MAINCOLOUR}is not for sale!`); return false; } if(getPlayerCurrentSubAccount(client).cash < getHouseData(houseId).buyPrice) { - messagePlayerError(client, `You don't have enough money to buy house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).name}!`); + messagePlayerError(client, `You don't have enough money to buy house {houseGreen}${getHouseData(houseId).name}!`); return false; } @@ -1090,7 +1090,7 @@ function buyHouseCommand(command, params, client) { updateHousePickupLabelData(houseId); - messagePlayerSuccess(client, `You are now the owner of ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description}`); + messagePlayerSuccess(client, `You are now the owner of {houseGreen}${getHouseData(houseId).description}`); } // =========================================================================== diff --git a/scripts/server/item.js b/scripts/server/item.js index 3d790190..4bccbcb5 100644 --- a/scripts/server/item.js +++ b/scripts/server/item.js @@ -303,10 +303,12 @@ function dropItemCommand(command, params, client) { } if(hotBarSlot == -1) { + messagePlayerError(client, `You don't have any item selected/equipped.`); return false; } if(getPlayerData(client).hotBarItems[hotBarSlot] == -1) { + messagePlayerError(client, `You don't have an item in your active slot.`); return false; } @@ -441,7 +443,7 @@ function createItemTypeCommand(command, params, client) { } let itemTypeIndex = createItemType(params); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} created new item ${getInlineChatColourByName("lightGrey")}${params}. ${getInlineChatColourByName("white")}ID: ${itemTypeIndex}/${getItemTypeData(itemTypeIndex).databaseId}!`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} created new item {ALTCOLOUR}${params}. {MAINCOLOUR}ID: ${itemTypeIndex}/${getItemTypeData(itemTypeIndex).databaseId}!`); } // =========================================================================== @@ -462,7 +464,7 @@ function setItemTypeDropModelCommand(command, params, client) { } getItemTypeData(itemTypeIndex).dropModel = modelId; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} set item type ${getInlineChatColourByName("lightGrey")}${getItemTypeData(itemTypeIndex).name} dropped object model to ${modelId}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} set item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name} dropped object model to ${modelId}`); } // =========================================================================== @@ -483,7 +485,7 @@ function setItemTypeOrderPriceCommand(command, params, client) { } getItemTypeData(itemTypeIndex).orderPrice = orderPrice; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} set item type ${getInlineChatColourByName("lightGrey")}${getItemTypeData(itemTypeIndex).name} ${getInlineChatColourByName("white")}base price to ${getInlineChatColourByName("lightGrey")}$${orderPrice}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} set item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name} {MAINCOLOUR}base price to {ALTCOLOUR}$${orderPrice}`); } // =========================================================================== @@ -504,7 +506,26 @@ function setItemTypeRiskMultiplierCommand(command, params, client) { } getItemTypeData(itemTypeIndex).riskMultiplier = riskMultiplier; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} set item type ${getInlineChatColourByName("lightGrey")}${getItemTypeData(itemTypeIndex).name} ${getInlineChatColourByName("white")}risk multilier to ${getInlineChatColourByName("lightGrey")}$${riskMultiplier}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} set item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name} {MAINCOLOUR}risk multilier to {ALTCOLOUR}$${riskMultiplier}`); +} + +// =========================================================================== + +function toggleItemTypeEnabledCommand(command, params, client) { + if(areParamsEmpty(params)) { + messagePlayerSyntax(client, getCommandSyntaxText(command)); + return false; + } + + let itemTypeIndex = getItemTypeFromParams(params); + + if(!getItemTypeData(itemTypeIndex)) { + messagePlayerError(client, `Invalid item type`); + return false; + } + + getItemTypeData(itemTypeIndex).enabled = !getItemTypeData(itemTypeIndex).enabled; + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} ${getEnabledDisabledFromBool(getItemTypeData(itemTypeIndex).enabled)} item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name}`); } // =========================================================================== @@ -525,7 +546,7 @@ function setItemTypeUseTypeCommand(command, params, client) { } getItemTypeData(itemTypeIndex).useType = useType; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} set item type ${getInlineChatColourByName("lightGrey")}${getItemTypeData(itemTypeIndex).name} ${getInlineChatColourByName("white")}use type to ${getInlineChatColourByName("lightGrey")}$${useType}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} set item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name} {MAINCOLOUR}use type to {ALTCOLOUR}$${useType}`); } // =========================================================================== @@ -546,7 +567,7 @@ function setItemTypeUseValueCommand(command, params, client) { } getItemTypeData(itemTypeIndex).useValue = useValue; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} set item type ${getInlineChatColourByName("lightGrey")}${getItemTypeData(itemTypeIndex).name} ${getInlineChatColourByName("white")}use value to ${getInlineChatColourByName("lightGrey")}$${useValue}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} set item type {ALTCOLOUR}${getItemTypeData(itemTypeIndex).name} {MAINCOLOUR}use value to {ALTCOLOUR}$${useValue}`); } // =========================================================================== @@ -580,14 +601,21 @@ function playerUseItem(client, hotBarSlot) { case VRR_ITEM_USETYPE_FOOD: meActionToNearbyPlayers(client, `eats their ${getItemName(itemIndex)}`); - givePlayerHealth(client, 25); + givePlayerHealth(client, getItemData(itemIndex).useValue); deleteItem(itemIndex); switchPlayerActiveHotBarSlot(client, -1); break; case VRR_ITEM_USETYPE_DRINK: meActionToNearbyPlayers(client, `drinks their ${getItemName(itemIndex)}`); - givePlayerHealth(client, 25); + givePlayerHealth(client, getItemData(itemIndex).useValue); + deleteItem(itemIndex); + switchPlayerActiveHotBarSlot(client, -1); + break; + + case VRR_ITEM_USETYPE_ARMOUR: + meActionToNearbyPlayers(client, `puts on a ${getItemName(itemIndex)}`); + givePlayerArmour(client, getItemData(itemIndex).useValue); deleteItem(itemIndex); switchPlayerActiveHotBarSlot(client, -1); break; @@ -733,7 +761,7 @@ function playerUseItem(client, hotBarSlot) { case VRR_ITEM_USETYPE_WALKIETALKIE: getItemData(itemIndex).enabled = !getItemData(itemIndex).enabled; - //messagePlayerAlert(client, `You turned ${getBoolRedGreenInlineColour(getItemData(itemIndex).enabled)}${toUpperCase(getOnOffFromBool(getItemData(itemIndex).enabled))} ${getInlineChatColourByName("white")}your walkie talkie in slot ${getPlayerData(client).activeHotBarSlot+1} ${getInlineChatColourByName("lightGrey")}${getItemValueDisplayForItem(itemIndex)}`); + //messagePlayerAlert(client, `You turned ${getBoolRedGreenInlineColour(getItemData(itemIndex).enabled)}${toUpperCase(getOnOffFromBool(getItemData(itemIndex).enabled))} {MAINCOLOUR}your walkie talkie in slot ${getPlayerData(client).activeHotBarSlot+1} {ALTCOLOUR}${getItemValueDisplayForItem(itemIndex)}`); meActionToNearbyPlayers(client, `turns ${toLowerCase(getOnOffFromBool(getItemData(itemIndex).enabled))} their walkie-talkie`); break; @@ -782,10 +810,10 @@ function playerUseItem(client, hotBarSlot) { let clients = getClients(); for(let i in clients) { if(getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= 7) { - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Badge ${getInlineChatColourByType("clanOrange")}====================================`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}Name: ${getInlineChatColourByName("white")}${getCharacterFullName(client)}`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}Type: ${getInlineChatColourByName("white")}${getJobData(getPlayerJob(client)).name}`); - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}Rank: ${getInlineChatColourByName("white")}${getJobRankData(getPlayerJob(client), getPlayerJobRank(client)).name}`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Badge {clanOrange}====================================`); + messagePlayerNormal(client, `{clanOrange}Name: {MAINCOLOUR}${getCharacterFullName(client)}`); + messagePlayerNormal(client, `{clanOrange}Type: {MAINCOLOUR}${getJobData(getPlayerJob(client)).name}`); + messagePlayerNormal(client, `{clanOrange}Rank: {MAINCOLOUR}${getJobRankName(getPlayerJob(client), getPlayerJobRank(client))}`); } } break; @@ -795,8 +823,11 @@ function playerUseItem(client, hotBarSlot) { break; } + if(getItemData(itemIndex) != false) { + getItemData(itemIndex).needsSaved = true; + } + cachePlayerHotBarItems(client); - getItemData(itemIndex).needsSaved = true; updatePlayerHotBar(client); } @@ -1352,6 +1383,18 @@ function saveAllItemsToDatabase() { // =========================================================================== +function saveAllItemTypesToDatabase() { + for(let i in getServerData().itemTypes) { + if(getServerData().itemTypes[i].needsSaved) { + if(getServerData().itemTypes[i].databaseId != -1) { + saveItemTypeToDatabase(getServerData().itemTypes[i]); + } + } + } +} + +// =========================================================================== + function saveItemToDatabase(itemData) { logToConsole(LOG_VERBOSE, `[VRR.Item]: Saving item '${itemData.index}' to database ...`); @@ -1392,6 +1435,8 @@ function saveItemToDatabase(itemData) { return false; } +// =========================================================================== + function saveItemTypeToDatabase(itemTypeData) { logToConsole(LOG_VERBOSE, `[VRR.Item]: Saving item type '${itemTypeData.name}' to database ...`); @@ -1596,7 +1641,7 @@ function toggleItemEnabledCommand(command, params, client) { } getItemData(getPlayerActiveItem(client)).enabled = !getItemData(getPlayerActiveItem(client)).enabled; - messagePlayerNormal(client, `You turned ${getBoolRedGreenInlineColour(getItemData(itemIndex).enabled)}${toUpperCase(getOnOffFromBool(getItemData(itemIndex).enabled))} ${getInlineChatColourByName("white")}your ${getItemName(getPlayerActiveItem(client))} in slot ${getPlayerActiveItemSlot(client)} ${getInlineChatColourByName("lightGrey")}${getItemValueDisplayForItem(getPlayerActiveItem(client))}`); + messagePlayerNormal(client, `You turned ${getBoolRedGreenInlineColour(getItemData(itemIndex).enabled)}${toUpperCase(getOnOffFromBool(getItemData(itemIndex).enabled))} {MAINCOLOUR}your ${getItemName(getPlayerActiveItem(client))} in slot ${getPlayerActiveItemSlot(client)} {ALTCOLOUR}${getItemValueDisplayForItem(getPlayerActiveItem(client))}`); } // =========================================================================== @@ -1638,7 +1683,7 @@ function deleteItemInPlayerInventoryCommand(command, params, client) { let tempName = getItemTypeData(getItemData(getPlayerData(targetClient).hotBarItems[hotBarSlot-1]).itemTypeIndex).name deleteItem(getPlayerData(targetClient).hotBarItems[hotBarSlot-1]); - messagePlayerSuccess(client, `You deleted the ${getInlineChatColourByName("lightGrey")}${tempName} ${getInlineChatColourByName("white")}item in ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(targetClient)}'s ${getInlineChatColourByName("white")}inventory`); + messagePlayerSuccess(client, `You deleted the {ALTCOLOUR}${tempName} {MAINCOLOUR}item in {ALTCOLOUR}${getCharacterFullName(targetClient)}'s {MAINCOLOUR}inventory`); } // =========================================================================== @@ -1662,7 +1707,7 @@ function deleteAllItemsInPlayerInventoryCommand(command, params, client) { deleteItem(getPlayerData(targetClient).hotBarItems[i]); } - messagePlayerSuccess(client, `You deleted all items in ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(targetClient)}'s ${getInlineChatColourByName("white")}inventory`); + messagePlayerSuccess(client, `You deleted all items in {ALTCOLOUR}${getCharacterFullName(targetClient)}'s {MAINCOLOUR}inventory`); } // =========================================================================== @@ -1736,20 +1781,20 @@ function clearPlayerItemActionStateAfterDelay(client, delay) { function showBusinessFloorInventoryToPlayer(client, businessId) { let itemDisplay = []; - messagePlayerNormal(client, `💲 ${getInlineChatColourByType("businessBlue")}== Business Items =========================`); + messagePlayerNormal(client, `💲 {businessBlue}== Business Items =========================`); for(let i in getBusinessData(businessId).floorItemCache) { if(getBusinessData(businessId).floorItemCache == -1) { - //itemDisplay.push(`${getInlineChatColourByType("jobYellow")}${toInteger(i)+1}${getInlineChatColourByName("lightGrey")}(Empty)`); - messagePlayerNormal(client, `${getInlineChatColourByName("yellow")}${toInteger(i)+1}${getInlineChatColourByName("lightGrey")}(Empty)`, COLOUR_WHITE); + //itemDisplay.push(`{jobYellow}${toInteger(i)+1}{ALTCOLOUR}(Empty)`); + messagePlayerNormal(client, `${getInlineChatColourByName("yellow")}${toInteger(i)+1}{ALTCOLOUR}(Empty)`, COLOUR_WHITE); } else { - //itemDisplay.push(`${getInlineChatColourByType("jobYellow")}${toInteger(i)+1}: ${getInlineChatColourByName("white")}${getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[i]).itemTypeIndex).name}${getInlineChatColourByName("lightGrey")}${getItemValueDisplayForItem(getBusinessData(businessId).floorItemCache[i])} - [${(getPlayerCurrentSubAccount(client).cash { // const ch = Math.floor(i/perChunk); @@ -1757,7 +1802,7 @@ function showBusinessFloorInventoryToPlayer(client, businessId) { // return all //}, []); //for(let i = 0 ; i <= splitItemDisplay.length-1 ; i++) { - // messagePlayerNormal(client, splitItemDisplay[i].join(`${getInlineChatColourByName("white")}, `), COLOUR_WHITE); + // messagePlayerNormal(client, splitItemDisplay[i].join(`{MAINCOLOUR}, `), COLOUR_WHITE); //} } @@ -1767,13 +1812,13 @@ function showBusinessStorageInventoryToPlayer(client, businessId) { let itemDisplay = []; for(let i in getBusinessData(businessId).storageItemCache) { if(getBusinessData(businessId).storageItemCache == -1) { - itemDisplay.push(`${getInlineChatColourByName("yellow")}${toInteger(i)+1}${getInlineChatColourByName("lightGrey")}(Empty)`); + itemDisplay.push(`${getInlineChatColourByName("yellow")}${toInteger(i)+1}{ALTCOLOUR}(Empty)`); } else { - itemDisplay.push(`${getInlineChatColourByName("yellow")}${toInteger(i)+1}: ${getInlineChatColourByName("white")}${getItemTypeData(getItemData(getBusinessData(businessId).storageItemCache[i]).itemTypeIndex).name}${getInlineChatColourByName("lightGrey")}${getItemValueDisplayForItem(getBusinessData(businessId).storageItemCache[i])} - [#CCCCCC]${getItemData(getBusinessData(businessId).storageItemCache[i]).amount} available`); + itemDisplay.push(`${getInlineChatColourByName("yellow")}${toInteger(i)+1}: {MAINCOLOUR}${getItemTypeData(getItemData(getBusinessData(businessId).storageItemCache[i]).itemTypeIndex).name}{ALTCOLOUR}${getItemValueDisplayForItem(getBusinessData(businessId).storageItemCache[i])} - [#CCCCCC]${getItemData(getBusinessData(businessId).storageItemCache[i]).amount} available`); } } - messagePlayerNormal(client, `🏢 ${getInlineChatColourByType("businessBlue")}== Business Storage =======================`); + messagePlayerNormal(client, `🏢 {businessBlue}== Business Storage =======================`); let perChunk=5; let splitItemDisplay = itemDisplay.reduce((all,one,i) => { const ch = Math.floor(i/perChunk); @@ -1782,7 +1827,7 @@ function showBusinessStorageInventoryToPlayer(client, businessId) { }, []); for(let i = 0 ; i <= splitItemDisplay.length-1 ; i++) { - messagePlayerNormal(client, splitItemDisplay[i].join(`${getInlineChatColourByName("white")}, `), COLOUR_WHITE); + messagePlayerNormal(client, splitItemDisplay[i].join(`{MAINCOLOUR}, `), COLOUR_WHITE); } } @@ -1792,13 +1837,13 @@ function showItemInventoryToPlayer(client, itemId) { let itemDisplay = []; for(let i in getItemData(itemId).itemCache) { if(getItemData(itemId).itemCache == -1) { - itemDisplay.push(`[#CCCCCC]${toInteger(i)+1}${getInlineChatColourByName("lightGrey")}(Empty)`); + itemDisplay.push(`[#CCCCCC]${toInteger(i)+1}{ALTCOLOUR}(Empty)`); } else { - itemDisplay.push(`[#CCCCCC]${toInteger(i)+1}: ${getInlineChatColourByName("lightGrey")}${getItemTypeData(getItemData(getItemData(itemId).itemCache[i]).itemTypeIndex).name}${getItemValueDisplayForItem(getItemData(itemId).itemCache[i])}`); + itemDisplay.push(`[#CCCCCC]${toInteger(i)+1}: {ALTCOLOUR}${getItemTypeData(getItemData(getItemData(itemId).itemCache[i]).itemTypeIndex).name}${getItemValueDisplayForItem(getItemData(itemId).itemCache[i])}`); } } - messagePlayerNormal(client, `📦 ${getInlineChatColourByName("lightGrey")}== Items Inside ===========================`); + messagePlayerNormal(client, `📦 {ALTCOLOUR}== Items Inside ===========================`); let perChunk=5; let splitItemDisplay = itemDisplay.reduce((all,one,i) => { const ch = Math.floor(i/perChunk); @@ -1807,7 +1852,7 @@ function showItemInventoryToPlayer(client, itemId) { }, []); for(let i = 0 ; i <= splitItemDisplay.length-1 ; i++) { - messagePlayerNormal(client, splitItemDisplay[i].join(`${getInlineChatColourByName("white")}, `), COLOUR_WHITE); + messagePlayerNormal(client, splitItemDisplay[i].join(`{MAINCOLOUR}, `), COLOUR_WHITE); } } @@ -1829,9 +1874,9 @@ function showPlayerInventoryToPlayer(client, targetClient) { } if(client == targetClient) { - messagePlayerNormal(client, `🎒 ${getInlineChatColourByName("lightGrey")}== Your Inventory =========================`); + messagePlayerNormal(client, `🎒 {ALTCOLOUR}== Your Inventory =========================`); } else { - messagePlayerNormal(client, `🎒 ${getInlineChatColourByName("lightGrey")}== ${getCharacterFullName(targetClient)}'s Inventory =========================`); + messagePlayerNormal(client, `🎒 {ALTCOLOUR}== ${getCharacterFullName(targetClient)}'s Inventory =========================`); } let perChunk=5; @@ -1842,7 +1887,7 @@ function showPlayerInventoryToPlayer(client, targetClient) { }, []); for(let i = 0 ; i <= splitItemDisplay.length-1 ; i++) { - messagePlayerNormal(client, splitItemDisplay[i].join(`${getInlineChatColourByName("white")}, `), COLOUR_WHITE); + messagePlayerNormal(client, splitItemDisplay[i].join(`{MAINCOLOUR}, `), COLOUR_WHITE); } } @@ -1852,13 +1897,13 @@ function showHouseInventoryToPlayer(client, houseId) { let itemDisplay = []; for(let i in getHouseData(houseId).itemCache) { if(getHouseData(houseId).itemCache == -1) { - itemDisplay.push(`[#CCCCCC]${toInteger(i)+1}${getInlineChatColourByName("lightGrey")}(Empty)`); + itemDisplay.push(`[#CCCCCC]${toInteger(i)+1}{ALTCOLOUR}(Empty)`); } else { - itemDisplay.push(`[#CCCCCC]${toInteger(i)+1}: ${getInlineChatColourByName("lightGrey")}${getItemTypeData(getItemData(getHouseData(houseId).itemCache[i]).itemTypeIndex).name}${getItemValueDisplayForItem(getBusinessData(houseId).itemCache[i])}`); + itemDisplay.push(`[#CCCCCC]${toInteger(i)+1}: {ALTCOLOUR}${getItemTypeData(getItemData(getHouseData(houseId).itemCache[i]).itemTypeIndex).name}${getItemValueDisplayForItem(getBusinessData(houseId).itemCache[i])}`); } } - messagePlayerNormal(client, `🏠 ${getInlineChatColourByType("houseGreen")}== House Items ============================`); + messagePlayerNormal(client, `🏠 {houseGreen}== House Items ============================`); let perChunk=5; let splitItemDisplay = itemDisplay.reduce((all,one,i) => { const ch = Math.floor(i/perChunk); @@ -1867,7 +1912,7 @@ function showHouseInventoryToPlayer(client, houseId) { }, []); for(let i = 0 ; i <= splitItemDisplay.length-1 ; i++) { - messagePlayerNormal(client, splitItemDisplay[i].join(`${getInlineChatColourByName("white")}, `), COLOUR_WHITE); + messagePlayerNormal(client, splitItemDisplay[i].join(`{MAINCOLOUR}, `), COLOUR_WHITE); } } @@ -1885,7 +1930,12 @@ function switchPlayerActiveHotBarSlot(client, slotId) { // =========================================================================== function isPlayerItemFromJobEquipment(client, hotBarSlot) { - if(getPlayerData(client).hotBarItems[hotBarSlot].databaseId = -1) { + let itemId = getPlayerData(client).hotBarItems[hotBarSlot]; + if(!getItemData(itemId)) { + return false; + } + + if(getItemData(itemId).databaseId == -1) { return true; } @@ -1915,4 +1965,6 @@ function createGroundPlant(itemId) { groundPlantCache.push(itemId); groundItemCache.push(itemId); -} \ No newline at end of file +} + +// =========================================================================== \ No newline at end of file diff --git a/scripts/server/item/walkie-talkie.js b/scripts/server/item/walkie-talkie.js index ded9b649..fcea15e4 100644 --- a/scripts/server/item/walkie-talkie.js +++ b/scripts/server/item/walkie-talkie.js @@ -56,21 +56,21 @@ function walkieTalkieTransmit(radioFrequency, messageText, transmittingPlayer) { function walkieTalkieOutgoingToNearbyPlayers(client, messageText) { let clients = getPlayersInRange(getPlayerPosition(client), getGlobalConfig().talkDistance); for(let i in clients) { - messagePlayerNormal(clients[i], `[#CCCCCC]${getCharacterFullName(client)} ${getInlineChatColourByName("lightGrey")}(to radio): ${getInlineChatColourByName("white")}${messageText}`); + messagePlayerNormal(clients[i], `[#CCCCCC]${getCharacterFullName(client)} {ALTCOLOUR}(to radio): {MAINCOLOUR}${messageText}`); } } // =========================================================================== function walkieTalkieIncomingToNearbyPlayers(client, messageText, position = null) { - let prefix = `${getInlineChatColourByName("lightGrey")}(Nearby radio)`; + let prefix = `{ALTCOLOUR}(Nearby radio)`; if(client != null) { - prefix = `${getCharacterFullName(client)} ${getInlineChatColourByName("lightGrey")}(from radio)`; + prefix = `${getCharacterFullName(client)} {ALTCOLOUR}(from radio)`; } let clients = getPlayersInRange(getPlayerPosition(client), getGlobalConfig().walkieTalkieSpeakerDistance); for(let i in clients) { - messagePlayerNormal(clients[i], `[#CCCCCC]${prefix}: ${getInlineChatColourByName("white")}${messageText}`); + messagePlayerNormal(clients[i], `[#CCCCCC]${prefix}: {MAINCOLOUR}${messageText}`); } } @@ -108,7 +108,7 @@ function setWalkieTalkieFrequencyCommand(command, params, client) { if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "use")) { messagePlayerError(client, `Your walkie talkie is turned off. Press ${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "use")).key)} to turn it on`); } else { - messagePlayerError(client, `Your walkie talkie is turned off. Type ${getInlineChatColourByName("lightGrey")}/use ${getInlineChatColourByName("white")}to turn it on`); + messagePlayerError(client, `Your walkie talkie is turned off. Type {ALTCOLOUR}/use {MAINCOLOUR}to turn it on`); } return false; } diff --git a/scripts/server/job.js b/scripts/server/job.js index 0f9626a2..bb09126f 100644 --- a/scripts/server/job.js +++ b/scripts/server/job.js @@ -342,7 +342,7 @@ function takeJobCommand(command, params, client) { } if(getPlayerCurrentSubAccount(client).job > VRR_JOB_NONE) { - messagePlayerError(client, `${getInlineChatColourByName("white")}You already have a job! Use ${getInlineChatColourByName("lightGrey")}/quitjob ${getInlineChatColourByName("white")}to quit your current job.`); + messagePlayerError(client, `{MAINCOLOUR}You already have a job! Use {ALTCOLOUR}/quitjob {MAINCOLOUR}to quit your current job.`); return false; } @@ -352,7 +352,7 @@ function takeJobCommand(command, params, client) { } takeJob(client, closestJobLocation.jobIndex); - messagePlayerSuccess(client, `${getInlineChatColourByName("white")}You now have the ${getInlineChatColourByType("jobYellow")}${jobData.name} ${getInlineChatColourByName("white")}job`); + messagePlayerSuccess(client, `{MAINCOLOUR}You now have the {jobYellow}${jobData.name} {MAINCOLOUR}job`); return true; } @@ -393,14 +393,14 @@ function startWorkingCommand(command, params, client) { if(getPlayerCurrentSubAccount(client).job != closestJobLocation.job) { messagePlayerError(client, "This is not your job!"); - messagePlayerInfo(client, `If you want this job, use /quitjob to quit your current job.`); + messagePlayerInfo(client, `If you want this job, use {ALTCOLOUR}/quitjob {MAINCOLOUR}to quit your current job.`); return false; } jobData = getJobData(closestJobLocation.jobIndex); } - messagePlayerSuccess(client, `You are now working as a ${jobData.name}`); + messagePlayerSuccess(client, `You are now working for the {jobYellow}${jobData.name} {MAINCOLOUR}job`); startWorking(client); //messagePlayerNewbieTip(client, `Enter a job vehicle to get started!`); return true; @@ -447,15 +447,15 @@ function startWorking(client) { let jobId = getPlayerCurrentSubAccount(client).job; switch(getJobIndexFromDatabaseId(jobId)) { case VRR_JOB_POLICE: - messagePlayerInfo(client, "Use /uniform and /equip to get your equipment."); + messagePlayerInfo(client, "Use {ALTCOLOUR}/uniform {MAINCOLOUR}and {ALTCOLOUR}/equip {MAINCOLOUR}to get your equipment."); break; case VRR_JOB_MEDICAL: - messagePlayerInfo(client, "Use /uniform and /equip to get your equipment."); + messagePlayerInfo(client, "Use {ALTCOLOUR}/uniform {MAINCOLOUR}and {ALTCOLOUR}/equip {MAINCOLOUR}to get your equipment."); break; case VRR_JOB_FIRE: - messagePlayerInfo(client, "Use /uniform and /equip to get your equipment."); + messagePlayerInfo(client, "Use {ALTCOLOUR}/uniform {MAINCOLOUR}and {ALTCOLOUR}/equip {MAINCOLOUR}to get your equipment."); break; case VRR_JOB_BUS: @@ -490,7 +490,7 @@ function startWorking(client) { function getJobInfoCommand(command, params, client) { let closestJobLocation = getClosestJobLocation(getPlayerPosition(client)); - messagePlayerInfo(client, `${getInlineChatColourByType("jobYellow")}[Job Info] ${getInlineChatColourByName("white")}Name: ${getInlineChatColourByName("lightGrey")}${getJobData(closestJobLocation.job).name}, ${getInlineChatColourByName("white")}Enabled: ${getInlineChatColourByName("lightGrey")}${getYesNoFromBool(intToBool(getJobData(closestJobLocation.job).enabled))}, ${getInlineChatColourByName("white")}Whitelisted: ${getInlineChatColourByName("lightGrey")}${getYesNoFromBool(intToBool(getJobData(closestJobLocation.job).whiteListEnabled))}, ${getInlineChatColourByName("white")}Blacklisted: ${getInlineChatColourByName("lightGrey")}${getYesNoFromBool(intToBool(getJobData(closestJobLocation.job).blackListEnabled))}, ${getInlineChatColourByName("white")}ID: ${getInlineChatColourByName("lightGrey")}${getJobData(closestJobLocation.job).id}/${closestJobLocation.job}`); + messagePlayerInfo(client, `{jobYellow}[Job Info] {MAINCOLOUR}Name: {ALTCOLOUR}${getJobData(closestJobLocation.job).name}, {MAINCOLOUR}Enabled: {ALTCOLOUR}${getYesNoFromBool(intToBool(getJobData(closestJobLocation.job).enabled))}, {MAINCOLOUR}Whitelisted: {ALTCOLOUR}${getYesNoFromBool(intToBool(getJobData(closestJobLocation.job).whiteListEnabled))}, {MAINCOLOUR}Blacklisted: {ALTCOLOUR}${getYesNoFromBool(intToBool(getJobData(closestJobLocation.job).blackListEnabled))}, {MAINCOLOUR}ID: {ALTCOLOUR}${getJobData(closestJobLocation.job).id}/${closestJobLocation.job}`); } // =========================================================================== @@ -498,7 +498,7 @@ function getJobInfoCommand(command, params, client) { function getJobLocationInfoCommand(command, params, client) { let closestJobLocation = getClosestJobLocation(getPlayerPosition(client)); - messagePlayerInfo(client, `${getInlineChatColourByType("jobYellow")}[Job Location Info] ${getInlineChatColourByName("white")}Job: ${getInlineChatColourByName("lightGrey")}${getJobData(closestJobLocation.job).name} (${getJobData(closestJobLocation.job).id}/${closestJobLocation.job}), ${getInlineChatColourByName("white")}Enabled: ${getInlineChatColourByName("lightGrey")}${getYesNoFromBool(closestJobLocation.enabled)}, ${getInlineChatColourByName("white")}Database ID: ${getInlineChatColourByName("lightGrey")}${closestJobLocation.databaseId}`); + messagePlayerInfo(client, `{jobYellow}[Job Location Info] {MAINCOLOUR}Job: {ALTCOLOUR}${getJobData(closestJobLocation.job).name} (${getJobData(closestJobLocation.job).id}/${closestJobLocation.job}), {MAINCOLOUR}Enabled: {ALTCOLOUR}${getYesNoFromBool(closestJobLocation.enabled)}, {MAINCOLOUR}Database ID: {ALTCOLOUR}${closestJobLocation.databaseId}`); } // =========================================================================== @@ -674,7 +674,7 @@ function jobUniformCommand(command, params, client) { setPlayerSkin(client, jobData.uniforms[uniformId-1].skin); - //messagePlayerSuccess(client, `You have been given a ${getInlineChatColourByName("lightGrey")}${uniforms[uniformId-1].name} ${getInlineChatColourByName("white")}uniform and you can put it on from your inventory.`); + //messagePlayerSuccess(client, `You have been given a {ALTCOLOUR}${uniforms[uniformId-1].name} {MAINCOLOUR}uniform and you can put it on from your inventory.`); meActionToNearbyPlayers(client, `puts on ${getProperDeterminerForName(jobData.uniforms[uniformId-1].name)} ${jobData.uniforms[uniformId-1].name} uniform`); //let itemId = createItem(getItemTypeFromParams("Outfit"), getJobData(jobId).uniforms[uniformId-1].skin, VRR_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId); //let freeSlot = getPlayerFirstEmptyHotBarSlot(client); @@ -837,7 +837,7 @@ function takeJob(client, jobId) { function reloadAllJobsCommand(command, params, client) { forceAllPlayersToStopWorking(); - getServerData().jobs = null; + clearArray(getServerData().jobs); getServerData().jobs = loadJobsFromDatabase(); for(let i in getServerData().jobs) { @@ -868,7 +868,7 @@ function createJobLocationCommand(command, params, client) { } createJobLocation(jobId, getPlayerPosition(client), getPlayerInterior(client), getPlayerDimension(client)); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}created a location for the ${getInlineChatColourByName("lightGrey")}${getJobData(jobId).name} ${getInlineChatColourByName("white")}job`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}created a location for the {ALTCOLOUR}${getJobData(jobId).name} {MAINCOLOUR}job`); return true; } @@ -877,7 +877,7 @@ function createJobLocationCommand(command, params, client) { function deleteJobLocationCommand(command, params, client) { let closestJobLocation = getClosestJobLocation(getPlayerPosition(client)); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}deleted location ${getInlineChatColourByName("lightGrey")}${closestJobLocation.databaseId} ${getInlineChatColourByName("white")}for the ${getInlineChatColourByName("lightGrey")}${getJobData(closestJobLocation.jobIndex).name} ${getInlineChatColourByName("white")}job`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}deleted location {ALTCOLOUR}${closestJobLocation.databaseId} {MAINCOLOUR}for the {ALTCOLOUR}${getJobData(closestJobLocation.jobIndex).name} {MAINCOLOUR}job`); quickDatabaseQuery(`DELETE FROM job_loc WHERE job_loc_id = ${closestJobLocation.databaseId}`); @@ -898,7 +898,7 @@ function toggleJobLocationEnabledCommand(command, params, client) { let closestJobLocation = getClosestJobLocation(getPlayerPosition(client)); closestJobLocation.enabled = !closestJobLocation.enabled; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}${getEnabledDisabledFromBool(closestJobLocation.enabled)} location ${getInlineChatColourByName("lightGrey")}${closestJobLocation.databaseId} ${getInlineChatColourByName("white")}for the ${getInlineChatColourByName("lightGrey")}${getJobData(closestJobLocation.jobIndex).name} ${getInlineChatColourByName("white")}job`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(closestJobLocation.enabled)} location {ALTCOLOUR}${closestJobLocation.databaseId} {MAINCOLOUR}for the {ALTCOLOUR}${getJobData(closestJobLocation.jobIndex).name} {MAINCOLOUR}job`); } // =========================================================================== @@ -912,7 +912,7 @@ function toggleJobEnabledCommand(command, params, client) { let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex; getJobData(jobId).enabled = !getJobData(jobId).enabled; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}${getEnabledDisabledFromBool(getJobData(jobId).enabled)} ${getInlineChatColourByName("white")}the ${getInlineChatColourByName("lightGrey")}${getJobData(jobId).name} ${getInlineChatColourByName("white")}job`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)} {MAINCOLOUR}the {ALTCOLOUR}${getJobData(jobId).name} {MAINCOLOUR}job`); } // =========================================================================== @@ -926,7 +926,7 @@ function toggleJobWhiteListCommand(command, params, client) { let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex; getJobData(jobId).whiteListEnabled = !getJobData(jobId).whiteListEnabled; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}${getEnabledDisabledFromBool(getJobData(jobId).whiteListEnabled)} ${getInlineChatColourByName("white")}the whitelist for the ${getInlineChatColourByName("lightGrey")}${getJobData(jobId).name} ${getInlineChatColourByName("white")}job`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).whiteListEnabled)} {MAINCOLOUR}the whitelist for the {ALTCOLOUR}${getJobData(jobId).name} {MAINCOLOUR}job`); } // =========================================================================== @@ -940,7 +940,7 @@ function toggleJobBlackListCommand(command, params, client) { let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex; getJobData(jobId).blackListEnabled = !getJobData(jobId).blackListEnabled; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}${getEnabledDisabledFromBool(getJobData(jobId).blackListEnabled)} ${getInlineChatColourByName("white")}the blacklist for the ${getInlineChatColourByName("lightGrey")}${getJobData(jobId).name} ${getInlineChatColourByName("white")}job`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).blackListEnabled)} {MAINCOLOUR}the blacklist for the {ALTCOLOUR}${getJobData(jobId).name} {MAINCOLOUR}job`); } // =========================================================================== @@ -970,7 +970,7 @@ function addPlayerToJobBlackListCommand(command, params, client) { } addPlayerToJobBlackList(targetClient, jobId); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}added ${getCharacterFullName(targetClient)} ${getInlineChatColourByName("white")}to the blacklist for the ${getInlineChatColourByName("lightGrey")}${jobData.name} ${getInlineChatColourByName("white")}job`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}added ${getCharacterFullName(targetClient)} {MAINCOLOUR}to the blacklist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`); } // =========================================================================== @@ -1000,7 +1000,7 @@ function removePlayerFromJobBlackListCommand(command, params, client) { } removePlayerFromJobBlackList(targetClient, jobId); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}removed ${getCharacterFullName(targetClient)} ${getInlineChatColourByName("white")}from the blacklist for the ${getInlineChatColourByName("lightGrey")}${jobData.name} ${getInlineChatColourByName("white")}job`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}removed ${getCharacterFullName(targetClient)} {MAINCOLOUR}from the blacklist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`); } // =========================================================================== @@ -1030,7 +1030,7 @@ function addPlayerToJobWhiteListCommand(command, params, client) { } addPlayerToJobWhiteList(targetClient, jobId); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}added ${getCharacterFullName(targetClient)} ${getInlineChatColourByName("white")}to the whitelist for the ${getInlineChatColourByName("lightGrey")}${jobData.name} ${getInlineChatColourByName("white")}job`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}added ${getCharacterFullName(targetClient)} {MAINCOLOUR}to the whitelist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`); } // =========================================================================== @@ -1060,7 +1060,7 @@ function removePlayerFromJobWhiteListCommand(command, params, client) { } removePlayerFromJobWhiteList(targetClient, jobId); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}removed ${getCharacterFullName(targetClient)} ${getInlineChatColourByName("white")}from the whitelist for the ${getInlineChatColourByName("lightGrey")}${jobData.name} ${getInlineChatColourByName("white")}job`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}removed ${getCharacterFullName(targetClient)} {MAINCOLOUR}from the whitelist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`); } // =========================================================================== @@ -1162,7 +1162,7 @@ function startJobRoute(client) { getPlayerVehicle(client).colour1 = getBusRouteData(getPlayerIsland(client), busRoute).busColour; getPlayerVehicle(client).colour2 = 1; showCurrentBusStop(client); - messagePlayerNormal(client, `🚌 You are now driving the ${getInlineChatColourByName("lightGrey")}${getBusRouteData(getPlayerIsland(client), busRoute).name} ${getInlineChatColourByName("white")}bus route! Drive to the green checkpoint.`); + messagePlayerNormal(client, `🚌 You are now driving the {ALTCOLOUR}${getBusRouteData(getPlayerIsland(client), busRoute).name} {MAINCOLOUR}bus route! Drive to the green checkpoint.`); } else if(doesPlayerHaveJobType(client, VRR_JOB_GARBAGE)) { let garbageRoute = getRandomBusRoute(getPlayerIsland(client)); getPlayerData(client).jobRoute = garbageRoute; @@ -1172,7 +1172,7 @@ function startJobRoute(client) { getPlayerVehicle(client).colour1 = getGarbageRouteData(getPlayerIsland(client), garbageRoute).garbageTruckColour; getPlayerVehicle(client).colour2 = 1; showCurrentGarbageStop(client); - messagePlayerNormal(client, `🚌 You are now driving the ${getInlineChatColourByName("lightGrey")}${getGarbageRouteData(getPlayerIsland(client), garbageRoute).name} ${getInlineChatColourByName("white")}garbage route! Drive to the grey checkpoint.`); + messagePlayerNormal(client, `🚌 You are now driving the {ALTCOLOUR}${getGarbageRouteData(getPlayerIsland(client), garbageRoute).name} {MAINCOLOUR}garbage route! Drive to the grey checkpoint.`); } } @@ -1727,4 +1727,10 @@ function deleteJobItems(client) { updatePlayerHotBar(client); } +// =========================================================================== + +function getJobRankName(jobId, rankId) { + return jobRankNames[jobId][rankId]; +} + // =========================================================================== \ No newline at end of file diff --git a/scripts/server/job/bus.js b/scripts/server/job/bus.js index b658de40..6d7dba00 100644 --- a/scripts/server/job/bus.js +++ b/scripts/server/job/bus.js @@ -437,7 +437,7 @@ function finishSuccessfulBusRoute(client) { let payout = toInteger(applyServerInflationMultiplier(getBusRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).payout)); getPlayerData(client).payDayAmount = getPlayerData(client).payDayAmount + payout; messagePlayerNormal(client, `You finished the ${getBusRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).name} bus route!. Your bus has been returned to the bus depot.`, getColourByName("yellow")); - messagePlayerNormal(client, `You earned $${getBusRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).payout*getServerData().inflationMultiplier}. Your total paycheck of ${getInlineChatColourByName("lightGrey")}${getPlayerData(client).payDayAmount} will be received in ${getInlineChatColourByName("lightGrey")}${getTimeDifferenceDisplay(sdl.ticks-getPlayerData(client).payDayTickStart)}`); + messagePlayerNormal(client, `You earned $${getBusRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).payout*getServerData().inflationMultiplier}. Your total paycheck of {ALTCOLOUR}${getPlayerData(client).payDayAmount} will be received in {ALTCOLOUR}${getTimeDifferenceDisplay(sdl.ticks-getPlayerData(client).payDayTickStart)}`); getPlayerData(client).jobRouteVehicle = false; getPlayerData(client).jobRoute = 0; getPlayerData(client).jobRouteStop = 0; diff --git a/scripts/server/job/garbage.js b/scripts/server/job/garbage.js index 6aef3ce8..cd19d9f6 100644 --- a/scripts/server/job/garbage.js +++ b/scripts/server/job/garbage.js @@ -148,7 +148,7 @@ function finishSuccessfulGarbageRoute(client) { let payout = toInteger(applyServerInflationMultiplier(getGarbageRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).payout)); getPlayerData(client).payDayAmount = getPlayerData(client).payDayAmount + payout; messagePlayerNormal(client, `You finished the ${getGarbageRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).name} garbage route! Your trashmaster has been returned to the garbage depot.`, getColourByName("yellow")); - messagePlayerNormal(client, `You earned $${getGarbageRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).payout*getServerData().inflationMultiplier}. Your total paycheck of ${getInlineChatColourByName("lightGrey")}${getPlayerData(client).payDayAmount} will be received in ${getInlineChatColourByName("lightGrey")}${getTimeDifferenceDisplay(sdl.ticks-getPlayerData(client).payDayTickStart)}: $${getPlayerData(client).payDayAmount}`); + messagePlayerNormal(client, `You earned $${getGarbageRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).payout*getServerData().inflationMultiplier}. Your total paycheck of {ALTCOLOUR}${getPlayerData(client).payDayAmount} will be received in {ALTCOLOUR}${getTimeDifferenceDisplay(sdl.ticks-getPlayerData(client).payDayTickStart)}: $${getPlayerData(client).payDayAmount}`); getPlayerData(client).jobRouteVehicle = false; getPlayerData(client).jobRoute = 0; getPlayerData(client).jobRouteStop = 0; diff --git a/scripts/server/job/pizza-delivery.js b/scripts/server/job/pizza-delivery.js index d80aca75..24004ebb 100644 --- a/scripts/server/job/pizza-delivery.js +++ b/scripts/server/job/pizza-delivery.js @@ -245,7 +245,7 @@ function playerArrivedAtPizzaDeliveryDestination(client) { let payout = applyServerInflationMultiplier(getPizzaDeliveryPay(getPlayerData(client).jobDeliveryStart, getPlayerData(client).jobDeliveryStop)); getPlayerData(client).payDayAmount += payout; messagePlayerNormal(client, `You delivered the pizza! Return to the pizza restaurant if you want to deliver another pizza.`, getColourByName("yellow")); - messagePlayerNormal(client, `You earned $${payout}. Your total paycheck of ${getInlineChatColourByName("lightGrey")}${getPlayerData(client).payDayAmount} will be received in ${getInlineChatColourByName("lightGrey")}${getTimeDisplayUntilPlayerPayDay(client)}`); + messagePlayerNormal(client, `You earned $${payout}. Your total paycheck of {ALTCOLOUR}${getPlayerData(client).payDayAmount} will be received in {ALTCOLOUR}${getTimeDisplayUntilPlayerPayDay(client)}`); getPlayerData(client).jobDeliveryVehicle = false; getPlayerData(client).jobDeliveryStart = 0; getPlayerData(client).jobDeliveryStop = 0; diff --git a/scripts/server/keybind.js b/scripts/server/keybind.js index 3e180e3e..f571cc0e 100644 --- a/scripts/server/keybind.js +++ b/scripts/server/keybind.js @@ -26,7 +26,7 @@ function addKeyBindCommand(command, params, client) { if(!keyId) { messagePlayerError(client, "The key ID or name you input is invalid!"); messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces."); - messagePlayerInfo(client, `Examples: ${getInlineChatColourByName("lightGrey")}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`); + messagePlayerInfo(client, `Examples: {ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`); return false; } @@ -41,7 +41,7 @@ function addKeyBindCommand(command, params, client) { } addPlayerKeyBind(client, keyId, tempCommand, tempParams); - messagePlayerSuccess(client, `You binded the ${getInlineChatColourByName("lightGrey")}${toUpperCase(getKeyNameFromId(keyId))} ${getInlineChatColourByName("white")}key to command: ${getInlineChatColourByName("lightGrey")}/${tempCommand} ${tempParams}`); + messagePlayerSuccess(client, `You binded the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key to command: {ALTCOLOUR}/${tempCommand} ${tempParams}`); } // =========================================================================== @@ -54,7 +54,7 @@ function removeKeyBindCommand(command, params, client) { if(!keyId) { messagePlayerError(client, "The key ID or name you input is invalid!"); messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces."); - messagePlayerInfo(client, `Examples: ${getInlineChatColourByName("lightGrey")}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`); + messagePlayerInfo(client, `Examples: {ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`); return false; } @@ -64,7 +64,7 @@ function removeKeyBindCommand(command, params, client) { } removePlayerKeyBind(client, keyId); - messagePlayerSuccess(client, `You removed the keybind for the ${getInlineChatColourByName("lightGrey")}${toUpperCase(getKeyNameFromId(keyId))} ${getInlineChatColourByName("white")}key`); + messagePlayerSuccess(client, `You removed the keybind for the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key`); } // =========================================================================== @@ -199,11 +199,11 @@ function loadKeyBindConfiguration() { // =========================================================================== function showKeyBindListCommand(command, params, client) { - let keybindList = getPlayerData(client).accountData.keyBinds.map(function(x) { return `${getInlineChatColourByName("lightGrey")}${toUpperCase(getKeyNameFromId(x.key))}: ${getInlineChatColourByName("white")}${x.commandString}`; }); + let keybindList = getPlayerData(client).accountData.keyBinds.map(function(x) { return `{ALTCOLOUR}${toUpperCase(getKeyNameFromId(x.key))}: {MAINCOLOUR}${x.commandString}`; }); let chunkedList = splitArrayIntoChunks(keybindList, 6); - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Your Key Binds ${getInlineChatColourByType("clanOrange")}===========================`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Your Key Binds {clanOrange}===========================`); for(let i in chunkedList) { messagePlayerInfo(client, chunkedList[i].join(", ")); diff --git a/scripts/server/locale.js b/scripts/server/locale.js index a0939cbc..88c84690 100644 --- a/scripts/server/locale.js +++ b/scripts/server/locale.js @@ -7,12 +7,10 @@ // TYPE: Server (JavaScript) // =========================================================================== -let localeStrings = {}; - -// =========================================================================== - function initLocaleScript() { - localeStrings = loadAllLocaleStrings(); + logToConsole(LOG_INFO, "[VRR.Locale]: Initializing locale script ..."); + getServerData().localeStrings = loadAllLocaleStrings(); + logToConsole(LOG_INFO, "[VRR.Locale]: Locale script initialized!"); } // =========================================================================== @@ -20,17 +18,19 @@ function initLocaleScript() { function getLocaleString(client, stringName, ...args) { let tempString = getRawLocaleString(stringName, getPlayerLocaleName(client)); - tempString = replaceColoursInLocaleString(tempString); + tempString = replaceColoursInMessage(tempString); - for(let i in args) { - tempString = tempString.replace(`{${i}}`, args[i]); + for(let i = 1; i <= args.length; i++) { + tempString = tempString.replace(`{${i}}`, args[i-1]); } + + return tempString; } // =========================================================================== function getRawLocaleString(stringName, localeName) { - return localeStrings[localeName][stringName]; + return getLocaleStrings()[localeName][stringName]; } // =========================================================================== @@ -40,18 +40,29 @@ function getPlayerLocaleName(client) { return getLocaleNameFromParams(`English`); } - return getPlayerData(client).accountData.locale; + return "english"; + //return getPlayerData(client).accountData.locale; } // =========================================================================== function loadAllLocaleStrings() { + let tempLocaleStrings = {}; + let locales = getGlobalConfig().locales; for(let i in locales) { let localeData = locales[i]; let localeFile = JSON.parse(loadTextFile(`locale/${localeData[1]}.json`)); - localeStrings[localeData[1]] = localeFile; + tempLocaleStrings[localeData[1]] = localeFile; } + + return tempLocaleStrings; +} + +// =========================================================================== + +function getLocaleStrings() { + return getServerData().localeStrings; } // =========================================================================== \ No newline at end of file diff --git a/scripts/server/messaging.js b/scripts/server/messaging.js index 2ee25cdf..2ccbd4df 100644 --- a/scripts/server/messaging.js +++ b/scripts/server/messaging.js @@ -23,6 +23,15 @@ function messageAdminAction(messageText) { // =========================================================================== +/** + * Sends a normal message to a player without any extra type + * + * @param {Client} client - The client/player to send the message to + * @param {string} messageText - The message string + * @param {Colour} colour - Colour given by toColour + * @return {bool} Whether or not the message was sent + * + */ function messagePlayerNormal(client, messageText, colour = COLOUR_WHITE) { if(isConsole(client)) { console.log(messageText); @@ -31,18 +40,19 @@ function messagePlayerNormal(client, messageText, colour = COLOUR_WHITE) { } sendChatBoxMessageToPlayer(client, `${replaceColoursInMessage(messageText)}`, colour); + return true; } // =========================================================================== -function messageAdmins(messageText, colour = COLOUR_WHITE) { +function messageAdmins(messageText, colour = getColourByName("softRed")) { let plainMessage = removeColoursInMessage(messageText); console.warn(`🛡️ ${plainMessage}`); let clients = getClients(); for(let i in clients) { if(doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("basicModeration"))) { - messagePlayerNormal(clients[i], `🛡️ ${messageText}`, getColourByName("softRed")); + messagePlayerNormal(clients[i], `🛡️ ${messageText}`, colour); } } @@ -60,9 +70,9 @@ function messagePlayerError(client, messageText) { } if(!isClientFromDiscord(client)) { - messagePlayerNormal(client, `🚫 ${messageText}`, getColourByName("white")); + messagePlayerNormal(client, `❌ ${messageText}`, getColourByName("white")); } else { - messageDiscordUser(client, `🚫 ${messageText}`); + messageDiscordUser(client, `❌ ${messageText}`); } } @@ -75,7 +85,7 @@ function messagePlayerSyntax(client, messageText) { } if(!isClientFromDiscord(client)) { - messagePlayerNormal(client, `⌨️ USAGE: ${getInlineChatColourByName("white")} ${messageText}`, getColourByType("syntaxMessage")); + messagePlayerNormal(client, `⌨️ USAGE: {MAINCOLOUR} ${messageText}`, getColourByType("syntaxMessage")); } else { messageDiscordUser(client, `⌨️ ${messageText}`); } @@ -105,9 +115,9 @@ function messagePlayerSuccess(client, messageText) { } if(!isClientFromDiscord(client)) { - messagePlayerNormal(client, `👍 ${messageText}`, getColourByName("white")); + messagePlayerNormal(client, `✔️ ${messageText}`, getColourByName("white")); } else { - messageDiscordUser(client, `👍 ${messageText}`); + messageDiscordUser(client, `✔️ ${messageText}`); } } @@ -176,13 +186,13 @@ function messagePlayerMeAction(client, doingActionClient, messageText) { // =========================================================================== function messagePlayerClanChat(client, clanChattingClient, messageText) { - messagePlayerNormal(client, `👥 ${getInlineChatColourByName("clanOrange")}${(getPlayerClanRankName(clanChattingClient) != false) ? getPlayerClanRankName(clanChattingClient) : "No Rank"} ${getCharacterFullName(clanChattingClient)} ${getInlineChatColourByName("white")}says (clan): ${getInlineChatColourByName("lightGrey")}${messageText}`, getColourByType("clanChatMessage")); + messagePlayerNormal(client, `👥 ${getInlineChatColourByName("clanOrange")}${(getPlayerClanRankName(clanChattingClient) != false) ? getPlayerClanRankName(clanChattingClient) : "No Rank"} ${getCharacterFullName(clanChattingClient)} {MAINCOLOUR}says (clan): {ALTCOLOUR}${messageText}`, getColourByType("clanChatMessage")); } // =========================================================================== function messagePlayerAdminChat(client, adminChattingClient, messageText) { - messagePlayerNormal(client, `🛡️ [ADMIN CHAT] ${getInlineChatColourByName("lightGrey")}${getPlayerData(adminChattingClient).accountData.staffTitle} [#CCCCCC]${getPlayerData(adminChattingClient).accountData.name}: ${getInlineChatColourByName("white")}${messageText}`, getColourByType("orange")); + messagePlayerNormal(client, `🛡️ [ADMIN CHAT] {ALTCOLOUR}${getPlayerData(adminChattingClient).accountData.staffTitle} [#CCCCCC]${getPlayerData(adminChattingClient).accountData.name}: {MAINCOLOUR}${messageText}`, getColourByType("orange")); } // =========================================================================== diff --git a/scripts/server/misc.js b/scripts/server/misc.js index e496b44e..5a5ba1a4 100644 --- a/scripts/server/misc.js +++ b/scripts/server/misc.js @@ -287,21 +287,21 @@ function getPlayerInfoCommand(command, params, client) { } } - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Admins ${getInlineChatColourByType("clanOrange")}===================================`); + messagePlayerNormal(client, `{clanOrange}== {jobYellow}Player Info {clanOrange}==============================`); - let clan = (getPlayerCurrentSubAccount(targetClient).clan != 0) ? `${getInlineChatColourByName("lightGrey")}${getClanData(getClanIdFromDatabaseId(getPlayerCurrentSubAccount(targetClient).clan)).name}[${getPlayerCurrentSubAccount(targetClient).clan}] (Rank: ${getClanRankData(clanId, getPlayerCurrentSubAccount(targetClient).clanRank).name}[Level: ${getClanRankData(clanId, getPlayerCurrentSubAccount(targetClient).clanRank).level}, DBID: ${getClanRankData(clanId, getPlayerCurrentSubAccount(targetClient).clanRank).databaseId}` : `(None)`; - let job = (getPlayerCurrentSubAccount(targetClient).job != 0) ? `${getInlineChatColourByName("lightGrey")}${getJobData(getJobIdFromDatabaseId(getPlayerCurrentSubAccount(targetClient).job)).name}[${getPlayerCurrentSubAccount(targetClient).job}] (Rank: ${getPlayerCurrentSubAccount(targetClient).jobRank})` : `(None)`; + let clan = (getPlayerCurrentSubAccount(targetClient).clan != 0) ? `{ALTCOLOUR}${getClanData(getClanIdFromDatabaseId(getPlayerCurrentSubAccount(targetClient).clan)).name}[${getPlayerCurrentSubAccount(targetClient).clan}] (Rank: ${getClanRankData(getPlayerCurrentSubAccount(targetClient).clan, getPlayerCurrentSubAccount(targetClient).clanRank).name}[Level: ${getClanRankData(getPlayerCurrentSubAccount(targetClient).clan, getPlayerCurrentSubAccount(targetClient).clanRank).level}, DBID: ${getClanRankData(getPlayerCurrentSubAccount(targetClient).clan, getPlayerCurrentSubAccount(targetClient).clanRank).databaseId}` : `(None)`; + let job = (getPlayerCurrentSubAccount(targetClient).job != 0) ? `{ALTCOLOUR}${getJobData(getJobIdFromDatabaseId(getPlayerCurrentSubAccount(targetClient).job)).name}[${getPlayerCurrentSubAccount(targetClient).job}] (Rank: ${getPlayerCurrentSubAccount(targetClient).jobRank})` : `(None)`; let stats = [ - `${getInlineChatColourByName("white")}Account: ${getInlineChatColourByName("lightGrey")}${getPlayerData(targetClient).accountData.name}[${getPlayerData(targetClient).accountData.databaseId}]`, - `${getInlineChatColourByName("white")}Character: ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(targetClient)}[${getPlayerCurrentSubAccount(targetClient).databaseId}]`, - `${getInlineChatColourByName("white")}Connected: ${getInlineChatColourByName("lightGrey")}${getTimeDifferenceDisplay(Math.ceil(sdl.tick/1000), getPlayerData(targetClient).connectTime)} ago`, - `${getInlineChatColourByName("white")}Registered: ${getPlayerData(targetClient).accountData}`, - `${getInlineChatColourByName("white")}Game Version: ${getInlineChatColourByName("lightGrey")}${targetClient.gameVersion}`, - `${getInlineChatColourByName("white")}Client Version: ${getInlineChatColourByName("lightGrey")}${getPlayerData(targetClient).clientVersion}`, - `${getInlineChatColourByName("white")}Skin: ${getInlineChatColourByName("lightGrey")}${getSkinNameFromModel(getPlayerCurrentSubAccount(targetClient).skin)}[${getPlayerCurrentSubAccount(targetClient).skin}]`, - `${getInlineChatColourByName("white")}Clan: ${getInlineChatColourByName("lightGrey")}${clan}`, - `${getInlineChatColourByName("white")}Job: ${getInlineChatColourByName("lightGrey")}${job}`, + `{MAINCOLOUR}Account: {ALTCOLOUR}${getPlayerData(targetClient).accountData.name}[${getPlayerData(targetClient).accountData.databaseId}]`, + `{MAINCOLOUR}Character: {ALTCOLOUR}${getCharacterFullName(targetClient)}[${getPlayerCurrentSubAccount(targetClient).databaseId}]`, + `{MAINCOLOUR}Connected: {ALTCOLOUR}${getTimeDifferenceDisplay(Math.ceil(sdl.tick/1000), getPlayerData(targetClient).connectTime)} ago`, + `{MAINCOLOUR}Registered: ${getPlayerData(targetClient).accountData}`, + `{MAINCOLOUR}Game Version: {ALTCOLOUR}${targetClient.gameVersion}`, + `{MAINCOLOUR}Client Version: {ALTCOLOUR}${getPlayerData(targetClient).clientVersion}`, + `{MAINCOLOUR}Skin: {ALTCOLOUR}${getSkinNameFromModel(getPlayerCurrentSubAccount(targetClient).skin)}[${getPlayerCurrentSubAccount(targetClient).skin}]`, + `{MAINCOLOUR}Clan: {ALTCOLOUR}${clan}`, + `{MAINCOLOUR}Job: {ALTCOLOUR}${job}`, ] @@ -354,7 +354,7 @@ function showPlayerPrompt(client, promptType, promptMessage, promptTitle) { showPlayerPromptGUI(client, promptMessage, promptTitle); } else { messagePlayerNormal(client, `❓ ${promptMessage}`); - messagePlayerInfo(client, `${getInlineChatColourByName("white")}Use ${getInlineChatColourByName("lightGrey")}/yes or ${getInlineChatColourByName("lightGrey")}/no`); + messagePlayerInfo(client, `{MAINCOLOUR}Use {ALTCOLOUR}/yes or {ALTCOLOUR}/no`); } } @@ -371,14 +371,14 @@ function updateServerGameTime() { function listOnlineAdminsCommand(command, params, client) { //== Admins =================================== - messagePlayerNormal(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Admins ${getInlineChatColourByType("clanOrange")}===================================`); + messagePlayerNormal(client, `{clanOrange}== {jobYellow}Admins {clanOrange}===================================`); let admins = []; let clients = getClients(); for(let i in clients) { if(getPlayerData(clients[i]) != false) { if(getPlayerData(clients[i]).accountData.flags.admin != 0) { - admins.push(`${getInlineChatColourByName("lightGrey")}[${getPlayerData(clients[i]).accountData.staffTitle}] ${getInlineChatColourByName("white")}${getCharacterFullName(clients[i])}`); + admins.push(`{ALTCOLOUR}[${getPlayerData(clients[i]).accountData.staffTitle}] {MAINCOLOUR}${getCharacterFullName(clients[i])}`); } } } diff --git a/scripts/server/moderation.js b/scripts/server/moderation.js index 3683753f..b814a13a 100644 --- a/scripts/server/moderation.js +++ b/scripts/server/moderation.js @@ -64,7 +64,7 @@ function setClientStaffTitleCommand(command, params, client) { } getPlayerData(targetClient).accountData.staffTitle = staffTitle; - messageAdmins(`${client.name} ${getInlineChatColourByName("white")}set ${getPlayerName(targetClient)}'s staff title to ${staffTitle}`); + messageAdmins(`${client.name} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s staff title to ${staffTitle}`); messagePlayerAlert(client, `${getPlayerName(client)} set your staff title to ${staffTitle}`); targetClient.disconnect(); } @@ -91,7 +91,7 @@ function muteClientCommand(command, params, client) { } } - messageAdmins(`${targetClient.name} ${getInlineChatColourByName("white")}has been muted by ${client.name}!`); + messageAdmins(`${targetClient.name} {MAINCOLOUR}has been muted by ${client.name}!`); getPlayerData(targetClient).muted = true; } @@ -118,7 +118,7 @@ function unMuteClientCommand(command, params, client) { } } - messageAdmins(`${targetClient.name} ${getInlineChatColourByName("white")}has been un-muted by ${client.name}!`); + messageAdmins(`${targetClient.name} {MAINCOLOUR}has been un-muted by ${client.name}!`); getPlayerData(targetClient).muted = false; } @@ -144,7 +144,7 @@ function freezeClientCommand(command, params, client) { } } - messageAdmins(`${targetClient.name} ${getInlineChatColourByName("white")}has been frozen by ${client.name}!`); + messageAdmins(`${targetClient.name} {MAINCOLOUR}has been frozen by ${client.name}!`); //setPlayerFrozenState(client, state); setPlayerControlState(client, false); } @@ -171,7 +171,7 @@ function unFreezeClientCommand(command, params, client) { } } - messageAdmins(`${targetClient.name} ${getInlineChatColourByName("white")}has been un-frozen by ${client.name}!`); + messageAdmins(`${targetClient.name} {MAINCOLOUR}has been un-frozen by ${client.name}!`); //sendPlayerFrozenState(client, false); setPlayerControlState(client, true); } @@ -205,7 +205,7 @@ function gotoPlayerCommand(command, params, client) { // updateInteriorLightsForPlayer(client, true); //}, 1000); - messagePlayerSuccess(client, `You teleported to ${getInlineChatColourByName("lightGrey")}${getPlayerName(targetClient)}`); + messagePlayerSuccess(client, `You teleported to {ALTCOLOUR}${getPlayerName(targetClient)}`); } // =========================================================================== @@ -226,7 +226,7 @@ function getGeoIPInformationCommand(command, params, client) { let subDivisionName = module.geoip.getSubdivisionName(getGlobalConfig().geoIPCityDatabaseFilePath, targetClient.ip); let cityName = module.geoip.getCityName(getGlobalConfig().geoIPCityDatabaseFilePath, targetClient.ip); - messagePlayerInfo(client, `${getInlineChatColourByName("lightGrey")}${targetClient.name} ${getInlineChatColourByName("white")}is from ${getInlineChatColourByName("lightGrey")}${cityName}, ${subDivisionName}, ${countryName}`); + messagePlayerInfo(client, `{ALTCOLOUR}${targetClient.name} {MAINCOLOUR}is from {ALTCOLOUR}${cityName}, ${subDivisionName}, ${countryName}`); } // =========================================================================== @@ -256,7 +256,7 @@ function gotoVehicleCommand(command, params, client) { // updateInteriorLightsForPlayer(client, true); //}, 500); - messagePlayerSuccess(client, `You teleported to a ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("lightGrey")}(ID ${vehicle.id})`); + messagePlayerSuccess(client, `You teleported to a {vehiclePurple}${getVehicleName(vehicle)} {ALTCOLOUR}(ID ${vehicle.id})`); } // =========================================================================== @@ -277,7 +277,7 @@ function getVehicleCommand(command, params, client) { setElementInterior(vehicle, getPlayerInterior(client)); setElementDimension(vehicle, getPlayerDimension(client)); - messageAdmins(`${client.name} ${getInlineChatColourByName("white")}teleported a ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("lightGrey")}(ID ${vehicle.id}) ${getInlineChatColourByName("white")}to you`); + messageAdmins(`${client.name} {MAINCOLOUR}teleported a {vehiclePurple}${getVehicleName(vehicle)} {ALTCOLOUR}(ID ${vehicle.id}) {MAINCOLOUR}to you`); } // =========================================================================== @@ -308,7 +308,7 @@ function gotoBusinessCommand(command, params, client) { // updateInteriorLightsForPlayer(client, true); //}, 500); - messagePlayerSuccess(client, `You teleported to business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("lightGrey")}(ID ${businessId})`); + messagePlayerSuccess(client, `You teleported to business {businessBlue}${getBusinessData(businessId).name} {ALTCOLOUR}(ID ${businessId})`); } // =========================================================================== @@ -339,7 +339,7 @@ function gotoGameLocationCommand(command, params, client) { // updateInteriorLightsForPlayer(client, true); //}, 500); - messagePlayerSuccess(client, `You teleported to game location ${getInlineChatColourByName("lightGrey")}${getGameData().locations[getServerGame()][gameLocationId][0]}`); + messagePlayerSuccess(client, `You teleported to game location {ALTCOLOUR}${getGameData().locations[getServerGame()][gameLocationId][0]}`); } // =========================================================================== @@ -370,7 +370,7 @@ function gotoHouseCommand(command, params, client) { // updateInteriorLightsForPlayer(client, true); //}, 500); - messagePlayerSuccess(client, `You teleported to house ${getInlineChatColourByType("houseGreen")}${getHouseData(houseId).description} ${getInlineChatColourByName("lightGrey")}(ID ${houseId})`); + messagePlayerSuccess(client, `You teleported to house {houseGreen}${getHouseData(houseId).description} {ALTCOLOUR}(ID ${houseId})`); } // =========================================================================== @@ -403,7 +403,7 @@ function gotoJobLocationCommand(command, params, client) { setPlayerDimension(client, getJobData(jobId).locations[jobLocationId].dimension); updateInteriorLightsForPlayer(client, true); - messagePlayerSuccess(client, `You teleported to location ${getInlineChatColourByName("lightGrey")}${jobLocationId} ${getInlineChatColourByName("white")}for the ${getInlineChatColourByName("jobYellow")}${getJobData(jobId).name} ${getInlineChatColourByName("white")}job`); + messagePlayerSuccess(client, `You teleported to location {ALTCOLOUR}${jobLocationId} {MAINCOLOUR}for the ${getInlineChatColourByName("jobYellow")}${getJobData(jobId).name} {MAINCOLOUR}job`); } // =========================================================================== @@ -444,7 +444,7 @@ function gotoPositionCommand(command, params, client) { setPlayerDimension(client, toInteger(vw)); updateInteriorLightsForPlayer(client, true); - messagePlayerSuccess(client, `You teleported to coordinates ${getInlineChatColourByName("lightGrey")}${x}, ${y}, ${z} with interior ${int} and dimension ${vw}`); + messagePlayerSuccess(client, `You teleported to coordinates {ALTCOLOUR}${x}, ${y}, ${z} with interior ${int} and dimension ${vw}`); } // =========================================================================== @@ -474,7 +474,7 @@ function teleportBackwardCommand(command, params, client) { setPlayerPosition(client, getPosBehindPos(getPlayerPosition(client), fixAngle(getPlayerHeading(client)), distance)); - messagePlayerSuccess(client, `You teleported backward ${getInlineChatColourByName("lightGrey")}${distance} ${getInlineChatColourByName("white")}meters`); + messagePlayerSuccess(client, `You teleported backward {ALTCOLOUR}${distance} {MAINCOLOUR}meters`); } // =========================================================================== @@ -489,7 +489,7 @@ function teleportLeftCommand(command, params, client) { setPlayerPosition(client, getPosToLeftOfPos(getPlayerPosition(client), fixAngle(getPlayerHeading(client)), distance)); - messagePlayerSuccess(client, `You teleported left ${getInlineChatColourByName("lightGrey")}${distance} ${getInlineChatColourByName("white")}meters`); + messagePlayerSuccess(client, `You teleported left {ALTCOLOUR}${distance} {MAINCOLOUR}meters`); } // =========================================================================== @@ -504,7 +504,7 @@ function teleportUpCommand(command, params, client) { setPlayerPosition(client, getPosAbovePos(getPlayerPosition(client), distance)); - messagePlayerSuccess(client, `You teleported up ${getInlineChatColourByName("lightGrey")}${distance} ${getInlineChatColourByName("white")}meters`); + messagePlayerSuccess(client, `You teleported up {ALTCOLOUR}${distance} {MAINCOLOUR}meters`); } // =========================================================================== @@ -519,7 +519,7 @@ function teleportDownCommand(command, params, client) { setPlayerPosition(client, getPosBelowPos(getPlayerPosition(client), distance)); - messagePlayerSuccess(client, `You teleported down ${getInlineChatColourByName("lightGrey")}${distance} ${getInlineChatColourByName("white")}meters`); + messagePlayerSuccess(client, `You teleported down {ALTCOLOUR}${distance} {MAINCOLOUR}meters`); } // =========================================================================== @@ -534,7 +534,7 @@ function teleportRightCommand(command, params, client) { setPlayerPosition(client, getPosToRightOfPos(getPlayerPosition(client), fixAngle(getPlayerHeading(client)), distance)); - messagePlayerSuccess(client, `You teleported right ${getInlineChatColourByName("lightGrey")}${distance} ${getInlineChatColourByName("white")}meters`); + messagePlayerSuccess(client, `You teleported right {ALTCOLOUR}${distance} {MAINCOLOUR}meters`); } // =========================================================================== @@ -553,13 +553,13 @@ function playerInteriorCommand(command, params, client) { } if(getParamsCount(params, " ") == 1) { - messagePlayerInfo(client, `${getPlayerName(targetClient)}'s interior is ${getInlineChatColourByName("lightGrey")}${getPlayerInterior(targetClient)}`); + messagePlayerInfo(client, `${getPlayerName(targetClient)}'s interior is {ALTCOLOUR}${getPlayerInterior(targetClient)}`); return false; } let interiorId = splitParams[1]; setPlayerInterior(targetClient, Number(interiorId)); - messageAdmins(`${client.name} ${getInlineChatColourByName("white")}set ${getPlayerName(targetClient)}'s interior to ${getInlineChatColourByName("lightGrey")}${interiorId}`); + messageAdmins(`${client.name} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s interior to {ALTCOLOUR}${interiorId}`); } // =========================================================================== @@ -578,13 +578,13 @@ function playerVirtualWorldCommand(command, params, client) { } if(getParamsCount(params, " ") == 1) { - messagePlayerInfo(client, `${getInlineChatColourByName("lightGrey")}${getPlayerName(targetClient)}'s ${getInlineChatColourByName("white")}virtual world is ${getInlineChatColourByName("lightGrey")}${getPlayerDimension(targetClient)}`); + messagePlayerInfo(client, `{ALTCOLOUR}${getPlayerName(targetClient)}'s {MAINCOLOUR}virtual world is {ALTCOLOUR}${getPlayerDimension(targetClient)}`); return false; } let dimensionId = splitParams[1]; setPlayerDimension(targetClient, Number(dimensionId)); - messageAdmins(`${client.name} ${getInlineChatColourByName("white")}set ${getInlineChatColourByName("lightGrey")}${getPlayerName(targetClient)}'s ${getInlineChatColourByName("white")}virtual world to ${getInlineChatColourByName("lightGrey")}${dimensionId}`); + messageAdmins(`${client.name} {MAINCOLOUR}set {ALTCOLOUR}${getPlayerName(targetClient)}'s {MAINCOLOUR}virtual world to {ALTCOLOUR}${dimensionId}`); } // =========================================================================== @@ -623,7 +623,7 @@ function getPlayerCommand(command, params, client) { setPlayerInterior(targetClient, getPlayerInterior(client)); setPlayerDimension(targetClient, getPlayerDimension(client)); - messageAdmins(`${client.name} ${getInlineChatColourByName("white")}teleported ${getInlineChatColourByName("lightGrey")}${getPlayerName(targetClient)} ${getInlineChatColourByName("white")}to their position.`); + messageAdmins(`${client.name} {MAINCOLOUR}teleported {ALTCOLOUR}${getPlayerName(targetClient)} {MAINCOLOUR}to their position.`); messagePlayerAlert(targetClient, `An admin has teleported you to their location`); } @@ -661,7 +661,7 @@ function returnPlayerCommand(command, params, client) { getPlayerData(targetClient).returnToBusiness = null; getPlayerData(targetClient).returnToType = VRR_RETURNTO_TYPE_NONE; - messageAdmins(`${client.name} ${getInlineChatColourByName("white")}returned ${getInlineChatColourByName("lightGrey")}${getPlayerName(targetClient)} ${getInlineChatColourByName("white")}to their previous position.`); + messageAdmins(`${client.name} {MAINCOLOUR}returned {ALTCOLOUR}${getPlayerName(targetClient)} {MAINCOLOUR}to their previous position.`); messagePlayerAlert(targetClient, `An admin has returned you to your previous location`); } @@ -696,7 +696,7 @@ function addStaffFlagCommand(command, params, client) { } givePlayerStaffFlag(targetClient, flagName); - messageAdmins(`${client.name} has ${getInlineChatColourByName("white")}given ${getInlineChatColourByName("lightGrey")}${getPlayerName(targetClient)} ${getInlineChatColourByName("white")}the ${getInlineChatColourByName("lightGrey")}${flagName} ${getInlineChatColourByName("white")}staff flag`); + messageAdmins(`${client.name} has {MAINCOLOUR}given {ALTCOLOUR}${getPlayerName(targetClient)} {MAINCOLOUR}the {ALTCOLOUR}${flagName} {MAINCOLOUR}staff flag`); } // =========================================================================== @@ -730,7 +730,7 @@ function takeStaffFlagCommand(command, params, client) { } takePlayerStaffFlag(targetClient, flagName); - messageAdmins(`${client.name} ${getInlineChatColourByName("white")}has taken the ${getInlineChatColourByName("lightGrey")}${flagName} ${getInlineChatColourByName("white")}staff flag from ${getInlineChatColourByName("lightGrey")}${getPlayerName(targetClient)}`); + messageAdmins(`${client.name} {MAINCOLOUR}has taken the {ALTCOLOUR}${flagName} {MAINCOLOUR}staff flag from {ALTCOLOUR}${getPlayerName(targetClient)}`); } // =========================================================================== @@ -764,7 +764,7 @@ function clearStaffFlagsCommand(command, params, client) { } clearPlayerStaffFlags(targetClient); - messageAdmins(`${client.name} ${getInlineChatColourByName("white")}removed all staff flags from ${getInlineChatColourByName("lightGrey")}${getPlayerName(targetClient)}`); + messageAdmins(`${client.name} {MAINCOLOUR}removed all staff flags from {ALTCOLOUR}${getPlayerName(targetClient)}`); } // =========================================================================== @@ -805,7 +805,7 @@ function getStaffFlagsCommand(command, params, client) { } } - messagePlayerInfo(client, `${getInlineChatColourByName("white")}${getPlayerName(targetClient)}'s staff flags: ${getInlineChatColourByName("lightGrey")}${tempStaffFlags.join(getInlineChatColourByName("white"))}, ${getInlineChatColourByName("lightGrey")}")}`); + messagePlayerInfo(client, `{MAINCOLOUR}${getPlayerName(targetClient)}'s staff flags: {ALTCOLOUR}${tempStaffFlags.join(getInlineChatColourByName("white"))}, {ALTCOLOUR}")}`); } // =========================================================================== @@ -825,7 +825,7 @@ function allStaffFlagsCommand(command, params, client) { return false; } - messagePlayerInfo(client, `${getInlineChatColourByName("white")}Staff flags: ${getInlineChatColourByName("lightGrey")}${getServerBitFlagKeys().join(getInlineChatColourByName("white"))}, ${getInlineChatColourByName("lightGrey")}")}`); + messagePlayerInfo(client, `{MAINCOLOUR}Staff flags: {ALTCOLOUR}${getServerBitFlagKeys().join(getInlineChatColourByName("white"))}, {ALTCOLOUR}")}`); } // =========================================================================== @@ -847,9 +847,9 @@ function givePlayerMoneyCommand(command, params, client) { givePlayerCash(client, toInteger(amount)); updatePlayerCash(targetClient); - //messagePlayerSuccess(client, `You gave ${getInlineChatColourByName("lightGrey")}$${amount} ${getInlineChatColourByName("white")}to ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(targetClient)}`); - messageAdmins(`${client.name} ${getInlineChatColourByName("white")}gave ${getInlineChatColourByName("lightGrey")}$${amount} ${getInlineChatColourByName("white")}to ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(targetClient)}`) - messagePlayerAlert(client, `An admin gave you ${getInlineChatColourByName("lightGrey")}$${amount}`); + //messagePlayerSuccess(client, `You gave {ALTCOLOUR}$${amount} {MAINCOLOUR}to {ALTCOLOUR}${getCharacterFullName(targetClient)}`); + messageAdmins(`${client.name} {MAINCOLOUR}gave {ALTCOLOUR}$${amount} {MAINCOLOUR}to {ALTCOLOUR}${getCharacterFullName(targetClient)}`) + messagePlayerAlert(client, `An admin gave you {ALTCOLOUR}$${amount}`); } // =========================================================================== @@ -876,13 +876,13 @@ function forcePlayerAccentCommand(command, params, client) { setPlayerAccentText(client, newAccent); if(newAccent == "") { - //messagePlayerSuccess(client, `You removed ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(targetClient)}'s ${getInlineChatColourByName("white")}accent.`); - messageAdmins(client, `${client.name} removed ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(targetClient)}'s ${getInlineChatColourByName("white")}accent.`); + //messagePlayerSuccess(client, `You removed {ALTCOLOUR}${getCharacterFullName(targetClient)}'s {MAINCOLOUR}accent.`); + messageAdmins(client, `${client.name} removed {ALTCOLOUR}${getCharacterFullName(targetClient)}'s {MAINCOLOUR}accent.`); messagePlayerAlert(client, `An admin removed your accent.`); } else { - //messagePlayerSuccess(client, `You set ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(targetClient)}'s ${getInlineChatColourByName("white")}accent to ${getInlineChatColourByName("lightGrey")}${newAccent}`); - messageAdmins(`${client.name} set ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(targetClient)}'s ${getInlineChatColourByName("white")}accent to ${getInlineChatColourByName("lightGrey")}${newAccent}`) - messagePlayerAlert(client, `An admin set your accent to ${getInlineChatColourByName("lightGrey")}${newAccent}`); + //messagePlayerSuccess(client, `You set {ALTCOLOUR}${getCharacterFullName(targetClient)}'s {MAINCOLOUR}accent to {ALTCOLOUR}${newAccent}`); + messageAdmins(`${client.name} set {ALTCOLOUR}${getCharacterFullName(targetClient)}'s {MAINCOLOUR}accent to {ALTCOLOUR}${newAccent}`) + messagePlayerAlert(client, `An admin set your accent to {ALTCOLOUR}${newAccent}`); } } @@ -904,7 +904,7 @@ function forceCharacterNameChangeCommand(command, params, client) { getPlayerData(targetClient).changingCharacterName = true; - messageAdmins(`${client.name} ${getInlineChatColourByName("white")}forced ${getInlineChatColourByName("lightGrey")}${getPlayerName(targetClient)} (${getCharacterFullName(targetClient)}) ${getInlineChatColourByName("white")}to change their character's name.`); + messageAdmins(`${client.name} {MAINCOLOUR}forced {ALTCOLOUR}${getPlayerName(targetClient)} (${getCharacterFullName(targetClient)}) {MAINCOLOUR}to change their character's name.`); showPlayerNewCharacterFailedGUI(targetClient, "Non-RP name! Choose a new one:"); } @@ -939,7 +939,7 @@ function forceCharacterNameCommand(command, params, client) { getPlayerCurrentSubAccount(targetClient).firstName = firstName; getPlayerCurrentSubAccount(targetClient).lastName = lastName; - messageAdmins(`${client.name} ${getInlineChatColourByName("white")}forced ${getInlineChatColourByName("lightGrey")}${getPlayerName(targetClient)}'s ${getInlineChatColourByName("white")}current character name from ${getInlineChatColourByName("lightGrey")}${oldName} ${getInlineChatColourByName("white")}to ${getInlineChatColourByName("lightGrey")}${newName}`); + messageAdmins(`${client.name} {MAINCOLOUR}forced {ALTCOLOUR}${getPlayerName(targetClient)}'s {MAINCOLOUR}current character name from {ALTCOLOUR}${oldName} {MAINCOLOUR}to {ALTCOLOUR}${newName}`); updateAllPlayerNameTags(); } @@ -974,7 +974,7 @@ function forcePlayerSkinCommand(command, params, client) { getPlayerCurrentSubAccount(targetClient).skin = skinIndex; setPlayerSkin(targetClient, skinIndex); - messageAdmins(`${client.name} ${getInlineChatColourByName("white")}set ${getPlayerName(targetClient)}'s ${getInlineChatColourByName("white")}skin to ${getInlineChatColourByName("lightGrey")}${getGameData().skins[getGame()][skinIndex][1]}`); + messageAdmins(`${client.name} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s {MAINCOLOUR}skin to {ALTCOLOUR}${getGameData().skins[getGame()][skinIndex][1]}`); } // =========================================================================== @@ -994,9 +994,9 @@ function getAllVehiclesOwnedByPlayerCommand(command, params, client) { let vehicles = getAllVehiclesOwnedByPlayer(targetClient); - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Player Vehicles ${getInlineChatColourByType("clanOrange")}==========================`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Player Vehicles {clanOrange}==========================`); for(let i in vehicles) { - messagePlayerNormal(client, `🚗 ${getInlineChatColourByType("vehiclePurple")}[Vehicle Info] ${getInlineChatColourByName("white")}ID: ${getInlineChatColourByName("lightGrey")}${vehicles[i].index}, ${getInlineChatColourByName("white")}DatabaseID: ${getInlineChatColourByName("lightGrey")}${vehicles[i].databaseId}, ${getInlineChatColourByName("white")}Type: ${getInlineChatColourByName("lightGrey")}${getVehicleName(vehicles[i].vehicle)}[${vehicles[i].model}], ${getInlineChatColourByName("white")}BuyPrice: ${getInlineChatColourByName("lightGrey")}${vehicles[i].buyPrice}, ${getInlineChatColourByName("white")}RentPrice: ${getInlineChatColourByName("lightGrey")}${vehicles[i].rentPrice}, ${getInlineChatColourByName("white")}Locked: ${getInlineChatColourByName("lightGrey")}${getYesNoFromBool(vehicles[i].locked)}, ${getInlineChatColourByName("white")}Engine: ${getInlineChatColourByName("lightGrey")}${getYesNoFromBool(vehicles[i].engine)}`); + messagePlayerNormal(client, `🚗 {vehiclePurple}[Vehicle Info] {MAINCOLOUR}ID: {ALTCOLOUR}${vehicles[i].index}, {MAINCOLOUR}DatabaseID: {ALTCOLOUR}${vehicles[i].databaseId}, {MAINCOLOUR}Type: {ALTCOLOUR}${getVehicleName(vehicles[i].vehicle)}[${vehicles[i].model}], {MAINCOLOUR}BuyPrice: {ALTCOLOUR}${vehicles[i].buyPrice}, {MAINCOLOUR}RentPrice: {ALTCOLOUR}${vehicles[i].rentPrice}, {MAINCOLOUR}Locked: {ALTCOLOUR}${getYesNoFromBool(vehicles[i].locked)}, {MAINCOLOUR}Engine: {ALTCOLOUR}${getYesNoFromBool(vehicles[i].engine)}`); } } @@ -1017,9 +1017,9 @@ function getAllBusinessesOwnedByPlayerCommand(command, params, client) { let businesses = getAllBusinessesOwnedByPlayer(targetClient); - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Player Businesses ${getInlineChatColourByType("clanOrange")}========================`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Player Businesses {clanOrange}========================`); for(let i in businesses) { - messagePlayerNormal(client, `🏢 ${getInlineChatColourByType("businessBlue")}[Business Info] ${getInlineChatColourByName("white")}Name: ${getInlineChatColourByName("lightGrey")}${businesses[i].name}, ${getInlineChatColourByName("white")}Locked: ${getInlineChatColourByName("lightGrey")}${getYesNoFromBool(intToBool(businesses[i].locked))}, ${getInlineChatColourByName("white")}ID: ${getInlineChatColourByName("lightGrey")}${businesses[i].index}/${businesses[i].databaseId}`); + messagePlayerNormal(client, `🏢 {businessBlue}[Business Info] {MAINCOLOUR}Name: {ALTCOLOUR}${businesses[i].name}, {MAINCOLOUR}Locked: {ALTCOLOUR}${getYesNoFromBool(intToBool(businesses[i].locked))}, {MAINCOLOUR}ID: {ALTCOLOUR}${businesses[i].index}/${businesses[i].databaseId}`); } } @@ -1040,10 +1040,34 @@ function getAllHousesOwnedByPlayerCommand(command, params, client) { let houses = getAllHousesOwnedByPlayer(targetClient); - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Player Houses ${getInlineChatColourByType("clanOrange")}============================`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Player Houses {clanOrange}============================`); for(let i in houses) { - messagePlayerNormal(client, `🏠 ${getInlineChatColourByType("houseGreen")}[House Info] ${getInlineChatColourByName("white")}Description: ${getInlineChatColourByName("lightGrey")}${houses[i].description}, ${getInlineChatColourByName("white")}Locked: ${getInlineChatColourByName("lightGrey")}${getYesNoFromBool(intToBool(houses[i].locked))}, ${getInlineChatColourByName("white")}ID: ${getInlineChatColourByName("lightGrey")}${houses[i].index}/${houses[i].databaseId}`); + messagePlayerNormal(client, `🏠 {houseGreen}[House Info] {MAINCOLOUR}Description: {ALTCOLOUR}${houses[i].description}, {MAINCOLOUR}Locked: {ALTCOLOUR}${getYesNoFromBool(intToBool(houses[i].locked))}, {MAINCOLOUR}ID: {ALTCOLOUR}${houses[i].index}/${houses[i].databaseId}`); } } +// =========================================================================== + +function forceAccountPasswordResetCommand(command, params, client) { + if(areParamsEmpty(params)) { + messagePlayerSyntax(client, getCommandSyntaxText(command)); + return false; + } + + let targetClient = getPlayerFromParams(params); + + if(!targetClient) { + messagePlayerError(client, "That player is not connected!"); + return false; + } + + let houses = getAllHousesOwnedByPlayer(targetClient); + + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Player Houses {clanOrange}============================`); + for(let i in houses) { + messagePlayerNormal(client, `🏠 {houseGreen}[House Info] {MAINCOLOUR}Description: {ALTCOLOUR}${houses[i].description}, {MAINCOLOUR}Locked: {ALTCOLOUR}${getYesNoFromBool(intToBool(houses[i].locked))}, {MAINCOLOUR}ID: {ALTCOLOUR}${houses[i].index}/${houses[i].databaseId}`); + } +} + + // =========================================================================== \ No newline at end of file diff --git a/scripts/server/native/connected.js b/scripts/server/native/connected.js index e2656b13..14d12ab4 100644 --- a/scripts/server/native/connected.js +++ b/scripts/server/native/connected.js @@ -3,19 +3,10 @@ // https://github.com/VortrexFTW/gtac_roleplay // =========================================================================== // FILE: gtac.js -// DESC: Provides natives for GTA Connected (GTA III, VC, SA, & IV) +// DESC: Provides natives for GTA and Mafia Connected mods // TYPE: Server (JavaScript) // =========================================================================== -// =========================================================================== -// Vortrex's Roleplay Resource -// https://github.com/VortrexFTW/gtac_roleplay -// =========================================================================== -// FILE: game-data.js -// DESC: Provides coords, ids, names, and other data for the games -// TYPE: Shared (JavaScript) -// =========================================================================== - // =========================================================================== function getPlayerPosition(client) { @@ -198,7 +189,7 @@ function setPlayerSkin(client, skinIndex) { // =========================================================================== function getPlayerSkin(client) { - return getSkinIndexFromSkin(client.player.modelIndex); + return getSkinIndexFromModel(client.player.modelIndex); } // =========================================================================== @@ -373,11 +364,11 @@ function getServerName() { // =========================================================================== -function createGamePickup(model, position, type) { +function createGamePickup(modelIndex, position, type) { if(!isGameFeatureSupported("pickups")) { return false; } - return game.createPickup(model, position, type); + return game.createPickup(modelIndex, position, type); } // =========================================================================== @@ -391,11 +382,11 @@ function createGameBlip(position, type = 0, colour = toColour(255, 255, 255, 255 // =========================================================================== -function createGameObject(model, position) { +function createGameObject(modelIndex, position) { if(!isGameFeatureSupported("objects")) { return false; } - return game.createObject(model, position); + return game.createObject(getGameData().objects[getGame()][modelIndex][0], position); } // =========================================================================== @@ -547,7 +538,7 @@ function setPlayerFightStyle(client, fightStyleId) { return false; } - if(!isFightStyleSupported()) { + if(!areFightStylesSupported()) { return false; } diff --git a/scripts/server/radio.js b/scripts/server/radio.js index ea6126a4..6bfd5709 100644 --- a/scripts/server/radio.js +++ b/scripts/server/radio.js @@ -189,11 +189,11 @@ function getPlayerStreamingRadioVolume(client) { // =========================================================================== function showRadioStationListCommand(command, params, client) { - let stationList = getServerData().radioStations.map(function(x) { return `${getInlineChatColourByName("lightGrey")}${x.index}: ${getInlineChatColourByName("white")}${x.name}`; }); + let stationList = getServerData().radioStations.map(function(x) { return `{ALTCOLOUR}${x.index}: {MAINCOLOUR}${x.name}`; }); let chunkedList = splitArrayIntoChunks(stationList, 4); - messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Radio Stations ${getInlineChatColourByType("clanOrange")}===========================`); + messagePlayerInfo(client, `{clanOrange}== {jobYellow}Radio Stations {clanOrange}===========================`); for(let i in chunkedList) { messagePlayerInfo(client, chunkedList[i].join(", ")); diff --git a/scripts/server/startup.js b/scripts/server/startup.js index 7b8a09f5..5442caf3 100644 --- a/scripts/server/startup.js +++ b/scripts/server/startup.js @@ -39,11 +39,12 @@ function initServerScripts() { initRadioScript(); initLocaleScript(); + initCommandScript(); initTimers(); serverStartTime = getCurrentUnixTimestamp(); - initCommandScript(); + initAllClients(); } // =========================================================================== diff --git a/scripts/server/timers.js b/scripts/server/timers.js index 7c27130f..8d048ff3 100644 --- a/scripts/server/timers.js +++ b/scripts/server/timers.js @@ -62,6 +62,12 @@ function saveAllServerDataToDatabase() { logToConsole(LOG_ERROR, `Could not save vehicles to database: ${error}`); } + try { + saveAllItemTypesToDatabase(); + } catch(error) { + logToConsole(LOG_ERROR, `Could not save items to database: ${error}`); + } + try { saveAllItemsToDatabase(); } catch(error) { diff --git a/scripts/server/utilities.js b/scripts/server/utilities.js index 3748d331..a510326c 100644 --- a/scripts/server/utilities.js +++ b/scripts/server/utilities.js @@ -337,6 +337,8 @@ function getCardinalDirection(pos1, pos2) { // =========================================================================== function getTimeDifferenceDisplay(timeStamp2, timeStamp1) { + timeStamp1 = timeStamp1 * 1000; + timeStamp2 = timeStamp2 * 1000; if(isNaN(timeStamp1) || isNaN(timeStamp2)) { return "Unknown"; } @@ -1538,11 +1540,13 @@ async function triggerWebHook(webHookURL, payloadData) { // =========================================================================== function clearTemporaryVehicles() { - let vehicles = getVehicles(); + let vehicles = getElementsByType(ELEMENT_VEHICLE); for(let i in vehicles) { if(vehicles[i].owner == -1) { if(!getVehicleData(vehicles[i])) { - destroyElement(vehicles[i]); + if(isVehicleUnoccupied(vehicles[i])) { + destroyElement(vehicles[i]); + } } } } @@ -1551,12 +1555,14 @@ function clearTemporaryVehicles() { // =========================================================================== function clearTemporaryPeds() { - let peds = getPeds(); + let peds = getElementsByType(ELEMENT_PED); for(let i in peds) { if(peds[i].owner == -1) { - if(peds[i].isType != ELEMENT_PLAYER) { - if(!getNPCData(peds[i])) { - destroyElement(peds[i]); + if(!peds[i].isType(ELEMENT_PLAYER)) { + if(peds[i].vehicle == null) { + if(!getNPCData(peds[i])) { + destroyElement(peds[i]); + } } } } diff --git a/scripts/server/vehicle.js b/scripts/server/vehicle.js index a85e11c5..e3e97667 100644 --- a/scripts/server/vehicle.js +++ b/scripts/server/vehicle.js @@ -217,7 +217,7 @@ function createVehicleCommand(command, params, client) { let frontPos = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getGlobalConfig().spawnCarDistance); let vehicle = createPermanentVehicle(modelIndex, frontPos, getPlayerHeading(client), getPlayerInterior(client), getPlayerDimension(client)); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}created a ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)}!`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}created a {vehiclePurple}${getVehicleName(vehicle)}!`); } // =========================================================================== @@ -238,7 +238,7 @@ function createTemporaryVehicleCommand(command, params, client) { let frontPos = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getGlobalConfig().spawnCarDistance); let vehicle = createTemporaryVehicle(modelIndex, frontPos, getPlayerHeading(client), getPlayerInterior(client), getPlayerDimension(client)); - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}created a temporary ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}created a temporary {vehiclePurple}${getVehicleName(vehicle)}`); } // =========================================================================== @@ -633,7 +633,7 @@ function rentVehicleCommand(command, params, client) { if(!getVehicleData(vehicle).engine) { if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "engine")) { - messagePlayerTip(client, `The ${getVehicleName(vehicle)}'s engine is off. Press ${getInlineChatColourByName("lightGrey")}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "engine").key))} ${getInlineChatColourByName("white")}to start it.`); + messagePlayerTip(client, `The ${getVehicleName(vehicle)}'s engine is off. Press {ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "engine").key))} {MAINCOLOUR}to start it.`); } else { messagePlayerAlert(client, `The ${getVehicleName(vehicle)}'s engine is off. Use /engine to start it`); } @@ -763,7 +763,7 @@ function setVehicleJobCommand(command, params, client) { getVehicleData(vehicle).needsSaved = true; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("white")}owner to the ${getInlineChatColourByType("jobYellow")}${getJobData(jobId).name} ${getInlineChatColourByName("white")}job! (Job ID ${jobId})`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set their {vehiclePurple}${getVehicleName(vehicle)} {MAINCOLOUR}owner to the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job! (Job ID ${jobId})`); } // =========================================================================== @@ -790,10 +790,10 @@ function setVehicleRankCommand(command, params, client) { return false; } getVehicleData(vehicle).rank = getClanRankData(getVehicleData(vehicle).ownerId, rankId).databaseId; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("white")}rank to ${getInlineChatColourByName("lightGrey")}${getClanRankData(getVehicleData(vehicle).ownerId, rankId).name} ${getInlineChatColourByName("white")}of the ${getInlineChatColourByType("clanOrange")}${getClanData(getVehicleData(vehicle).ownerId).name} [#FFFFFFclan!`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set their {vehiclePurple}${getVehicleName(vehicle)} {MAINCOLOUR}rank to {ALTCOLOUR}${getClanRankData(getVehicleData(vehicle).ownerId, rankId).name} {MAINCOLOUR}of the {clanOrange}${getClanData(getVehicleData(vehicle).ownerId).name} [#FFFFFFclan!`); } else if(getVehicleData(vehicle).ownerType == VRR_VEHOWNER_JOB) { getVehicleData(vehicle).rank = rankId; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("white")}rank to ${getInlineChatColourByName("lightGrey")}${rankId} ${getInlineChatColourByName("white")}of the ${getInlineChatColourByType("jobYellow")}${getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name} ${getInlineChatColourByName("white")}job!`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set their {vehiclePurple}${getVehicleName(vehicle)} {MAINCOLOUR}rank to {ALTCOLOUR}${rankId} {MAINCOLOUR}of the {jobYellow}${getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name} {MAINCOLOUR}job!`); } getVehicleData(vehicle).needsSaved = true; @@ -818,7 +818,7 @@ function setVehicleClanCommand(command, params, client) { getVehicleData(vehicle).ownerType = VRR_VEHOWNER_CLAN; getVehicleData(vehicle).ownerId = getClanData(clanId).databaseId; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("white")}owner to the ${getInlineChatColourByType("clanOrange")}${getClanData(clanId).name} ${getInlineChatColourByName("white")}clan`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set their {vehiclePurple}${getVehicleName(vehicle)} {MAINCOLOUR}owner to the {clanOrange}${getClanData(clanId).name} {MAINCOLOUR}clan`); getVehicleData(vehicle).needsSaved = true; } @@ -837,7 +837,7 @@ function setVehicleToBusinessCommand(command, params, client) { getVehicleData(vehicle).ownerType = VRR_VEHOWNER_BIZ; getVehicleData(vehicle).ownerId = getBusinessData(businessId).databaseId; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("white")}owner to the ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}business`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set their {vehiclePurple}${getVehicleName(vehicle)} {MAINCOLOUR}owner to the {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}business`); getVehicleData(vehicle).needsSaved = true; } @@ -861,7 +861,7 @@ function setVehicleOwnerCommand(command, params, client) { getVehicleData(vehicle).ownerType = VRR_VEHOWNER_PLAYER; getVehicleData(vehicle).ownerId = getPlayerCurrentSubAccount(targetClient).databaseId; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("white")}owner to ${getInlineChatColourByName("lightGrey")}${getClientSubAccountName(targetClient)}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set their {vehiclePurple}${getVehicleName(vehicle)} {MAINCOLOUR}owner to {ALTCOLOUR}${getClientSubAccountName(targetClient)}`); getVehicleData(vehicle).needsSaved = true; } @@ -879,7 +879,7 @@ function setVehiclePublicCommand(command, params, client) { getVehicleData(vehicle).ownerType = VRR_VEHOWNER_PUBLIC; getVehicleData(vehicle).ownerId = 0; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("white")}a public vehicle!`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set their {vehiclePurple}${getVehicleName(vehicle)} {MAINCOLOUR}a public vehicle!`); getVehicleData(vehicle).needsSaved = true; } @@ -904,7 +904,7 @@ function setVehicleRentPriceCommand(command, params, client) { getVehicleData(vehicle).rentPrice = amount; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("white")}rent price to ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(amount)}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set their {vehiclePurple}${getVehicleName(vehicle)} {MAINCOLOUR}rent price to {ALTCOLOUR}$${makeLargeNumberReadable(amount)}`); getVehicleData(vehicle).needsSaved = true; } @@ -929,7 +929,7 @@ function setVehicleBuyPriceCommand(command, params, client) { getVehicleData(vehicle).buyPrice = amount; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)}'s ${getInlineChatColourByName("white")}buy price to ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(amount)}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set their {vehiclePurple}${getVehicleName(vehicle)}'s {MAINCOLOUR}buy price to {ALTCOLOUR}$${makeLargeNumberReadable(amount)}`); getVehicleData(vehicle).needsSaved = true; } @@ -953,7 +953,7 @@ function removeVehicleOwnerCommand(command, params, client) { getVehicleData(vehicle).ownerType = VRR_VEHOWNER_NONE; getVehicleData(vehicle).ownerId = 0; - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("white")}owner to nobody!`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set their {vehiclePurple}${getVehicleName(vehicle)} {MAINCOLOUR}owner to nobody!`); messagePlayerInfo(client, `Nobody will be able to use this vehicle until it receives a new owner (either bought or set by admin).`); } @@ -1003,7 +1003,7 @@ function getVehicleInfoCommand(command, params, client) { break; } - messagePlayerNormal(client, `🚗 ${getInlineChatColourByType("vehiclePurple")}[Vehicle Info] ${getInlineChatColourByName("white")}ID: ${getInlineChatColourByName("lightGrey")}${getElementId(vehicle)}, ${getInlineChatColourByName("white")}DatabaseID: ${getInlineChatColourByName("lightGrey")}${vehicleData.databaseId}, ${getInlineChatColourByName("white")}Owner: ${getInlineChatColourByName("lightGrey")}${ownerName}[ID ${vehicleData.ownerId}] (${ownerType}), ${getInlineChatColourByName("white")}Type: ${getInlineChatColourByName("lightGrey")}${getVehicleName(vehicle)}[${vehicle.modelIndex}], ${getInlineChatColourByName("white")}BuyPrice: ${getInlineChatColourByName("lightGrey")}${vehicleData.buyPrice}, ${getInlineChatColourByName("white")}RentPrice: ${getInlineChatColourByName("lightGrey")}${vehicleData.rentPrice}`); + messagePlayerNormal(client, `🚗 {vehiclePurple}[Vehicle Info] {MAINCOLOUR}ID: {ALTCOLOUR}${getElementId(vehicle)}, {MAINCOLOUR}DatabaseID: {ALTCOLOUR}${vehicleData.databaseId}, {MAINCOLOUR}Owner: {ALTCOLOUR}${ownerName}[ID ${vehicleData.ownerId}] (${ownerType}), {MAINCOLOUR}Type: {ALTCOLOUR}${getVehicleName(vehicle)}[${vehicle.modelIndex}], {MAINCOLOUR}BuyPrice: {ALTCOLOUR}${vehicleData.buyPrice}, {MAINCOLOUR}RentPrice: {ALTCOLOUR}${vehicleData.rentPrice}`); } // =========================================================================== @@ -1052,7 +1052,7 @@ function getLastVehicleInfoCommand(command, params, client) { break; } - messagePlayerNormal(client, `🚗 ${getInlineChatColourByType("vehiclePurple")}[Vehicle Info] ${getInlineChatColourByName("white")}ID: ${getInlineChatColourByName("lightGrey")}${vehicle.id}, ${getInlineChatColourByName("white")}DatabaseID: ${getInlineChatColourByName("lightGrey")}${vehicleData.databaseId}, ${getInlineChatColourByName("white")}Owner: ${getInlineChatColourByName("lightGrey")}${ownerName}[ID ${vehicleData.ownerId}] (${ownerType}), ${getInlineChatColourByName("white")}Type: ${getInlineChatColourByName("lightGrey")}${getVehicleName(vehicle)}[${vehicle.modelIndex}], ${getInlineChatColourByName("white")}BuyPrice: ${getInlineChatColourByName("lightGrey")}${vehicleData.buyPrice}, ${getInlineChatColourByName("white")}RentPrice: ${getInlineChatColourByName("lightGrey")}${vehicleData.rentPrice}`); + messagePlayerNormal(client, `🚗 {vehiclePurple}[Vehicle Info] {MAINCOLOUR}ID: {ALTCOLOUR}${vehicle.id}, {MAINCOLOUR}DatabaseID: {ALTCOLOUR}${vehicleData.databaseId}, {MAINCOLOUR}Owner: {ALTCOLOUR}${ownerName}[ID ${vehicleData.ownerId}] (${ownerType}), {MAINCOLOUR}Type: {ALTCOLOUR}${getVehicleName(vehicle)}[${vehicle.modelIndex}], {MAINCOLOUR}BuyPrice: {ALTCOLOUR}${vehicleData.buyPrice}, {MAINCOLOUR}RentPrice: {ALTCOLOUR}${vehicleData.rentPrice}`); } // =========================================================================== @@ -1071,7 +1071,7 @@ function toggleVehicleSpawnLockCommand(command, params, client) { getVehicleData(vehicle).spawnRotation = getVehicleHeading(vehicle); } - messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("white")}to spawn ${getInlineChatColourByName("lightGrey")}${(getVehicleData(vehicle).spawnLocked) ? "at it's current location" : "wherever a player leaves it."}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set their {vehiclePurple}${getVehicleName(vehicle)} {MAINCOLOUR}to spawn {ALTCOLOUR}${(getVehicleData(vehicle).spawnLocked) ? "at it's current location" : "wherever a player leaves it."}`); getVehicleData(vehicle).needsSaved = true; } @@ -1085,7 +1085,7 @@ function reloadAllVehiclesCommand(command, params, client) { } } - getServerData().vehicles = null; + clearArray(getServerData().vehicles); getServerData().vehicles = loadVehiclesFromDatabase(); spawnAllVehicles(); @@ -1428,4 +1428,16 @@ function getVehicleFromDatabaseId(databaseId) { } } +// =========================================================================== + +function isVehicleUnoccupied(vehicle) { + for(let i = 0 ; i <= 8 ; i++) { + if(vehicle.getOccupant(i) != null) { + return true; + } + } + + return false; +} + // =========================================================================== \ No newline at end of file diff --git a/scripts/shared/utilities.js b/scripts/shared/utilities.js index 2c568d8b..765531e9 100644 --- a/scripts/shared/utilities.js +++ b/scripts/shared/utilities.js @@ -422,6 +422,12 @@ function Enum(constantsList) { // =========================================================================== +function clearArray(array) { + array.splice(0, array.length) +} + +// =========================================================================== + function isServerScript() { return (typeof server != "undefined"); } @@ -510,8 +516,8 @@ function isCustomCameraSupported() { // =========================================================================== -function isFightStyleSupported() { - return supportedFeatures.fightStyle[getGame()]; +function areFightStylesSupported() { + return supportedFeatures.fightStyles[getGame()]; } // ===========================================================================