Use new inHouse in player data

This commit is contained in:
Vortrex
2021-04-23 18:19:04 -05:00
parent aa3ef37ce5
commit e249009fc2

View File

@@ -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;
}
// ===========================================================================