diff --git a/scripts/server/house.js b/scripts/server/house.js index ce69dc8c..6cb66f7e 100644 --- a/scripts/server/house.js +++ b/scripts/server/house.js @@ -404,8 +404,8 @@ function getClosestHouseEntrance(position) { // =========================================================================== function getPlayerHouse(client) { - if(doesEntityDataExist(client, "ag.inHouse")) { - return getEntityData(client, "ag.inHouse"); + if(getPlayerData(client).inHouse > 0) { + return getPlayerData(client).inHouse; } return false; @@ -648,7 +648,11 @@ function getHouseInfoCommand(command, params, client) { // =========================================================================== function isPlayerInAnyHouse(client) { - return doesEntityDataExist(client, "ag.inHouse"); + if(getPlayerData(client).inHouse > 0) { + return true; + } + + return false; } // =========================================================================== @@ -739,7 +743,7 @@ function exitHouse(client) { setPlayerDimension(client, getServerData().house[houseId].entranceDimension); setPlayerPosition(client, getServerData().house[houseId].entrancePosition); } - removeEntityData(client, "ag.inHouse"); + getPlayerData(client).inHouse = 0; } // =========================================================================== @@ -770,4 +774,16 @@ function cacheHouseItems(houseId) { } } +// =========================================================================== + +function getHouseIdFromDatabaseId(databaseId) { + for(let i in getServerData().houses) { + if(getHouseData(i).databaseId == databaseId) { + return i; + } + } + + return false; +} + // =========================================================================== \ No newline at end of file