Use getPlayerHouse for checking if in one
This commit is contained in:
@@ -575,10 +575,8 @@ function deleteHouse(houseId, whoDeleted = 0) {
|
|||||||
* @return {bool} Whether or not the player was successfully removed from the house
|
* @return {bool} Whether or not the player was successfully removed from the house
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function removePlayerFromHouses(client) {
|
function removePlayerFromHouse(client) {
|
||||||
if(isPlayerInAnyHouse(client)) {
|
exitHouse(client);
|
||||||
exitHouse(client);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1082,7 +1080,7 @@ function setHouseBuyPriceCommand(command, params, client) {
|
|||||||
getHouseData(houseId).buyPrice = amount;
|
getHouseData(houseId).buyPrice = amount;
|
||||||
getHouseData(houseId).needsSaved = true;
|
getHouseData(houseId).needsSaved = true;
|
||||||
updateHousePickupLabelData(houseId);
|
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).rentPrice = amount;
|
||||||
getHouseData(houseId).needsSaved = true;
|
getHouseData(houseId).needsSaved = true;
|
||||||
updateHousePickupLabelData(houseId);
|
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
|
* @param {number} houseIndex - The data index of the house
|
||||||
* @return {HouseData} The house's data (class instance)
|
* @return {HouseData} The house's data (class instance)
|
||||||
@@ -1250,8 +1242,8 @@ function deleteHouseExitBlip(houseId) {
|
|||||||
function reloadAllHousesCommand(command, params, client) {
|
function reloadAllHousesCommand(command, params, client) {
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for(let i in clients) {
|
||||||
if(isPlayerInAnyHouse(clients[i])) {
|
if(getPlayerHouse(clients[i]) != -1) {
|
||||||
removePlayerFromHouses(clients[i]);
|
removePlayerFromHouse(clients[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1267,7 +1259,7 @@ function reloadAllHousesCommand(command, params, client) {
|
|||||||
createAllHousePickups();
|
createAllHousePickups();
|
||||||
createAllHouseBlips();
|
createAllHouseBlips();
|
||||||
|
|
||||||
announceAdminAction(`HousesReloaded`);
|
announceAdminAction(`AllHousesReloaded`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1279,7 +1271,6 @@ function exitHouse(client) {
|
|||||||
setPlayerDimension(client, getServerData().house[houseId].entranceDimension);
|
setPlayerDimension(client, getServerData().house[houseId].entranceDimension);
|
||||||
setPlayerPosition(client, getServerData().house[houseId].entrancePosition);
|
setPlayerPosition(client, getServerData().house[houseId].entrancePosition);
|
||||||
}
|
}
|
||||||
removeEntityData(client, "vrr.inHouse");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user