From b01f4190ff3a8092b4b7c91b5bc5e689f746b34a Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Wed, 11 May 2022 04:00:46 -0500 Subject: [PATCH] Use getPlayerHouse for checking if in one --- scripts/server/house.js | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/scripts/server/house.js b/scripts/server/house.js index ce06161e..edceea11 100644 --- a/scripts/server/house.js +++ b/scripts/server/house.js @@ -575,10 +575,8 @@ function deleteHouse(houseId, whoDeleted = 0) { * @return {bool} Whether or not the player was successfully removed from the house * */ -function removePlayerFromHouses(client) { - if(isPlayerInAnyHouse(client)) { - exitHouse(client); - } +function removePlayerFromHouse(client) { + exitHouse(client); } // =========================================================================== @@ -1082,7 +1080,7 @@ function setHouseBuyPriceCommand(command, params, client) { getHouseData(houseId).buyPrice = amount; getHouseData(houseId).needsSaved = true; updateHousePickupLabelData(houseId); - messageAdmins(client, `{MAINCOLOUR}You set house {houseGreen}${getHouseData(houseId).description}'s {MAINCOLOUR}for-sale price to {ALTCOLOUR}$${makeLargeNumberReadable(amount)}`); + messagePlayerSuccess(client, `{MAINCOLOUR}You set house {houseGreen}${getHouseData(houseId).description}'s{MAINCOLOUR} for-sale price to {ALTCOLOUR}$${makeLargeNumberReadable(amount)}`); } // =========================================================================== @@ -1120,7 +1118,7 @@ function setHouseRentPriceCommand(command, params, client) { getHouseData(houseId).rentPrice = amount; getHouseData(houseId).needsSaved = true; updateHousePickupLabelData(houseId); - messagePlayerSuccess(client, `{MAINCOLOUR}You set house {houseGreen}${getHouseData(houseId).description}'s {MAINCOLOUR}rent price to {ALTCOLOUR}$${makeLargeNumberReadable(amount)}`); + messagePlayerSuccess(client, `{MAINCOLOUR}You set house {houseGreen}${getHouseData(houseId).description}'s{MAINCOLOUR} rent price to {ALTCOLOUR}$${makeLargeNumberReadable(amount)}`); } // =========================================================================== @@ -1158,12 +1156,6 @@ function buyHouseCommand(command, params, client) { // =========================================================================== -function isPlayerInAnyHouse(client) { - return doesEntityDataExist(client, "vrr.inHouse"); -} - -// =========================================================================== - /** * @param {number} houseIndex - The data index of the house * @return {HouseData} The house's data (class instance) @@ -1250,8 +1242,8 @@ function deleteHouseExitBlip(houseId) { function reloadAllHousesCommand(command, params, client) { let clients = getClients(); for(let i in clients) { - if(isPlayerInAnyHouse(clients[i])) { - removePlayerFromHouses(clients[i]); + if(getPlayerHouse(clients[i]) != -1) { + removePlayerFromHouse(clients[i]); } } @@ -1267,7 +1259,7 @@ function reloadAllHousesCommand(command, params, client) { createAllHousePickups(); createAllHouseBlips(); - announceAdminAction(`HousesReloaded`); + announceAdminAction(`AllHousesReloaded`); } // =========================================================================== @@ -1279,7 +1271,6 @@ function exitHouse(client) { setPlayerDimension(client, getServerData().house[houseId].entranceDimension); setPlayerPosition(client, getServerData().house[houseId].entrancePosition); } - removeEntityData(client, "vrr.inHouse"); } // ===========================================================================