Crypton3
Retired
- Joined
- Mar 13, 2010
- Messages
- 549
- Reaction score
- 139
Simple function for getting all free houses. Works well with TFS 0.4. Can be useful in script that teleports player to random / first free house.
Code:
function getFreeHouses()
local towns = getTownList()
local houses = {}
for i = 1, #towns do
local list = getTownHouses(towns[i].id)
for j = 1, #list do
if list[j] then
if getHouseOwner(list[j]) == 0 then
table.insert(houses, list[j])
end
end
end
end
if #houses == 0 then
return nil
end
return houses
end
Last edited: