local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end

houses = {
    {
        id = 1,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-170925.921875, -33268.609375, 1229.1983642578, 0},
        text = {-171000.421875, -33466.25, 1227.6971435547},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -171043,
                y = -33401,
                z = 1131,
                r = 90
            },
            {
                entity = -1,
                model = 23,
                x = -171090,
                y = -33189,
                z = 1130,
                r = 0
            },
            {
                entity = -1,
                model = 41,
                x = -172818,
                y = -33414,
                z = 1025,
                r = 0
            }
        }
    },
    {
        id = 2,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-174669.234375, -36615.8203125, 1227.7788085938, 0},
        text = {-174832.296875, -36621.96484375, 1227.1726074219},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -174799,
                y = -36578,
                z = 1129,
                r = 0
            },
            {
                entity = -1,
                model = 23,
                x = -174097,
                y = -37446,
                z = 1129,
                r = 0
            },
            {
                entity = -1,
                model = 23,
                x = -174380,
                y = -36595,
                z = 1468,
                r = 0
            },
            {
                entity = -1,
                model = 23,
                x = -174139,
                y = -37072,
                z = 1467,
                r = 90
            },
            {
                entity = -1,
                model = 41,
                x = -174589,
                y = -38487,
                z = 1025,
                r = -90
            }
        }
    },
    {
        id = 3,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-177951.015625, -36964.82421875, 1236.9774169922, 0},
        text = {-177775.0625, -36968.03515625, 1232.1761474609},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -177823,
                y = -37014,
                z = 1139,
                r = 180
            },
            {
                entity = -1,
                model = 23,
                x = -178293,
                y = -36769,
                z = 1139,
                r = 90
            },
            {
                entity = -1,
                model = 41,
                x = -177836,
                y = -38578,
                z = 1025,
                r = 90
            }
        }
    },
    {
        id = 4,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-177982.640625, -41709.20703125, 1235.4838867188, 0},
        text = {-177808.453125, -41703.95703125, 1227.4689941406},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -177842,
                y = -41749,
                z = 1137,
                r = 180
            },
            {
                entity = -1,
                model = 23,
                x = -178502,
                y = -41690,
                z = 1137,
                r = 90
            }
        }
    },
    {
        id = 5,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-174131.640625, -41843.55859375, 1227.8481445313, 0},
        text = {-174132.265625, -42024.71484375, 1227.0222167969},
        doors = {
            {
                entity = -1,
                model = 21,
                x = -174179,
                y = -41970,
                z = 1129,
                r = 90
            },
            {
                entity = -1,
                model = 41,
                x = -172828,
                y = -41752,
                z = 1025,
                r = 0
            }
        }
    },
    {
        id = 6,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-169924.265625, -45905.42578125, 1240.1983642578, 0},
        text = {-169766.84375, -45728.04296875, 1237.1525878906},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -169720,
                y = -45762,
                z = 1141,
                r = 270
            },
            {
                entity = -1,
                model = 22,
                x = -170169,
                y = -46594,
                z = 1141,
                r = 90
            },
            {
                entity = -1,
                model = 24,
                x = -169674,
                y = -45973,
                z = 1142,
                r = 180
            }
        }
    },
    {
        id = 7,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-174477.25, -46827.19921875, 1247.6391601563, 0},
        text = {-174619.734375, -46827.60546875, 1237.1765136719},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -174585,
                y = -46782,
                z = 1150,
                r = 0
            },
            {
                entity = -1,
                model = 41,
                x = -174588,
                y = -45277,
                z = 1025,
                r = -90
            }
        }
    },
    {
        id = 8,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-177772.359375, -45908.84765625, 1239.1857910156, 0},
        text = {-177765.703125, -45769.59375, 1232.1630859375},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -177721,
                y = -45803,
                z = 1140,
                r = -90
            },
            {
                entity = -1,
                model = 23,
                x = -177673,
                y = -46192,
                z = 1140,
                r = 180
            }
        }
    },
    {
        id = 9,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-177647.359375, -49682.26953125, 1244.6986083984, 0},
        text = {-177499.15625, -49685.515625, 1237.4119873047},
        doors = {
            {
                entity = -1,
                model = 21,
                x = -177532,
                y = -49729,
                z = 1145,
                r = 180
            },
            {
                entity = -1,
                model = 23,
                x = -178660,
                y = -49881,
                z = 1146,
                r = 0
            },
            {
                entity = -1,
                model = 22,
                x = -179061,
                y = -49841,
                z = 1146,
                r = 0
            }
        }
    },
    {
        id = 10,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-162374.625, -36704.3828125, 1179.8830566406, 0},
        text = {-162252.421875, -36704.33984375, 1182.3640136719},
        doors = {
            {
                entity = -1,
                model = 40,
                x = -162288,
                y = -36656,
                z = 1085,
                r = 0
            }
        }
    },
    {
        id = 11,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-161461.625, -39828.9140625, 1182.1553955078, 0},
        text = {-161348.671875, -39832.46484375, 1182.1553955078},
        doors = {
            {
                entity = -1,
                model = 40,
                x = -161386,
                y = -39784,
                z = 1085,
                r = 0
            }
        }
    },
    {
        id = 12,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-158540.296875, -39682.5078125, 1183.2471923828, 0},
        text = {-158432.078125, -39682.453125, 1183.7580566406},
        doors = {
            {
                entity = -1,
                model = 40,
                x = -158468,
                y = -39638.199219,
                z = 1085,
                r = 0
            }
        }
    },
    {
        id = 13,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-158366.25, -36742.921875, 1179.8830566406, 0},
        text = {-158361.1875, -36869.93359375, 1182.3640136719},
        doors = {
            {
                entity = -1,
                model = 40,
                x = -158320,
                y = -36831.199219,
                z = 1085,
                r = -90
            }
        }
    },
    {
        id = 14,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-155138.546875, -37943.53515625, 1179.8830566406, 0},
        text = {-155139.625, -38035.80078125, 1182.3640136719},
        doors = {
            {
                entity = -1,
                model = 40,
                x = -155095,
                y = -38000.199219,
                z = 1085,
                r = -90
            }
        }
    },
    {
        id = 15,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-155251.765625, -35692.234375, 1182.1553955078, 0},
        text = {-155360.65625, -35692.38671875, 1182.1553955078},
        doors = {
            {
                entity = -1,
                model = 40,
                x = -155325,
                y = -35741,
                z = 1085,
                r = -180
            }
        }
    },
    {
        id = 16,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-178881.03125, -55652.6015625, 1234.1956787109, 0},
        text = {-178885.734375, -55772.125, 1227.7380371094},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -178929,
                y = -55734,
                z = 1136,
                r = 90
            },
            {
                entity = -1,
                model = 21,
                x = -178481,
                y = -54904,
                z = 1136,
                r = -90
            },
            {
                entity = -1,
                model = 41,
                x = -180508,
                y = -55740,
                z = 1025,
                r = 0
            }
        }
    },
    {
        id = 17,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-180347.609375, -58988.8359375, 1260.90234375, 0},
        text = {-180344.265625, -58874.5390625, 1247.1533203125},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -180300,
                y = -58908,
                z = 1162,
                r = -90
            },
            {
                entity = -1,
                model = 21,
                x = -180607,
                y = -59875,
                z = 1163,
                r = 90
            }
        }
    },
    {
        id = 18,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-183801.109375, -55658.9453125, 1234.1982421875, 0},
        text = {-183806.1875, -55767.91015625, 1227.4790039063},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -183854,
                y = -55734,
                z = 1136,
                r = 90
            },
            {
                entity = -1,
                model = 22,
                x = -183406,
                y = -54904,
                z = 1136,
                r = -90
            },
            {
                entity = -1,
                model = 41,
                x = -185429,
                y = -55740,
                z = 1025,
                r = 0
            }
        }
    },
    {
        id = 19,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-184816.359375, -59492.55859375, 1240.2672119141, 0},
        text = {-184703.578125, -59495.83203125, 1227.6677246094},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -184737,
                y = -59543,
                z = 1142,
                r = -180
            }
        }
    },
    {
        id = 20,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-187944.484375, -55663.140625, 1234.1983642578, 0},
        text = {-187943.40625, -55767.58984375, 1227.6694335938},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -187989,
                y = -55734,
                z = 1136,
                r = 90
            },
            {
                entity = -1,
                model = 22,
                x = -187541,
                y = -54904,
                z = 1136,
                r = -90
            },
            {
                entity = -1,
                model = 41,
                x = -189619,
                y = -55740,
                z = 1025,
                r = 0
            }
        }
    },
    {
        id = 21,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-187447.578125, -59081.828125, 1234.1983642578, 0},
        text = {-187442.9375, -58979.546875, 1227.6531982422},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -187398,
                y = -59013,
                z = 1136,
                r = -90
            },
            {
                entity = -1,
                model = 41,
                x = -189483,
                y = -59061,
                z = 1025,
                r = -180
            }
        }
    },
    {
        id = 22,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-193419.578125, -53819.87890625, 1240.1038818359, 0},
        text = {-193317.703125, -53825.0625, 1232.0913085938},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -193351,
                y = -53869,
                z = 1142,
                r = 180
            },
            {
                entity = -1,
                model = 21,
                x = -194321,
                y = -53563,
                z = 1142,
                r = 0
            },
            {
                entity = -1,
                model = 41,
                x = -193301,
                y = -55363,
                z = 1025,
                r = 90
            }
        }
    },
    {
        id = 23,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-187995.96875, -62689.67578125, 1234.1983642578, 0},
        text = {-187992.78125, -62791.9609375, 1227.4311523438},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -188044,
                y = -62758,
                z = 1136,
                r = 90
            },
            {
                entity = -1,
                model = 21,
                x = -187596,
                y = -61929,
                z = 1136,
                r = -9
            },
            {
                entity = -1,
                model = 41,
                x = -189647,
                y = -62736,
                z = 1025,
                r = 0
            }
        }
    },
    {
        id = 24,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-184625.703125, -62431.58984375, 1225.2888183594, 0},
        text = {-184515.765625, -62431.81640625, 1227.7380371094},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -184564,
                y = -62479,
                z = 1127,
                r = 180
            }
        }
    },
    {
        id = 25,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-181522.953125, -62986.84765625, 1229.1857910156, 0},
        text = {-181525.671875, -63100.46484375, 1228.0900878906},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -181573,
                y = -63059,
                z = 1131,
                r = 90
            },
            {
                entity = -1,
                model = 41,
                x = -179389,
                y = -62734,
                z = 1025,
                r = 0
            }
        }
    },
    {
        id = 26,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-172571.3125, -88361.0390625, 1600.3059082031, 0},
        text = {-172675.140625, -88305.8671875, 1598.4008789063},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -172624.25,
                y = -88277.867188,
                z = 1502,
                r = -26
            },
            {
                entity = -1,
                model = 22,
                x = -172194.53125,
                y = -89294.8125,
                z = 1502,
                r = 154
            },
            {
                entity = -1,
                model = 42,
                x = -172121.671875,
                y = -87257.554688,
                z = 1421,
                r = -116
            }
        }
    },
    {
        id = 27,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-180066.546875, -83100.4375, 1743.3872070313, 0},
        text = {-180063.203125, -83200.5546875, 1737.4022216797},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -180113.28125,
                y = -83168.921875,
                z = 1645,
                r = 92
            },
            {
                entity = -1,
                model = 41,
                x = -176790.890625,
                y = -83896.84375,
                z = 1589,
                r = -88
            },
            {
                entity = -1,
                model = 41,
                x = -176838.281250,
                y = -82539.664063,
                z = 1589,
                r = -88
            }
        }
    },
    { -- TO CHECK
        id = 28,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = {-173915.4375, -50723.91796875, 1244.5828857422, 0},
        text = {-173912.359375, -50595.3359375, 1227.9490966797},
        doors = {
            {
                entity = -1,
                model = 20,
                x = -173865,
                y = -50645,
                z = 1147,
                r = 270
            },
            {
                entity = -1,
                model = 24,
                x = -173922,
                y = -51310,
                z = 1144,
                r = 180
            }
        }
    },
    {
        id = 29,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 192134, -45438, 1534, 0},
        text = { 192072, -45240, 1536 },
        doors = {
            {
                entity = -1,
                model = 20,
                x = 192122,
                y = -45262.136719,
                z = 1436,
                r = 290
            },
            {
                entity = -1,
                model = 24,
                x = 192512.546875,
                y = -45539.789063,
                z = 1436,
                r = 200
            }
        }
    },
    {
        id = 30,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 186505, -41455, 1515, 0},
        text = { 186680, -41605, 1517 },
        doors = {
            {
                entity = -1,
                model = 20,
                x = 186641.968750,
                y = -41649.476563,
                z = 1417,
                r = 175
            },
            {
                entity = -1,
                model = 24,
                x = 186425.968750,
                y = -41678.332031,
                z = 1417,
                r = 85
            },
            {
                entity = -1,
                model = 21,
                x = 185851.750000,
                y = -41129.601563,
                z = 1417,
                r = -5
            }
        }
    },
    {
        id = 31,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 48492, 138461, 1572, 0},
        text = { 48478, 138293, 1574 },
        doors = {
            {
                entity = -1,
                model = 55,
                x = 48556,
                y = 138325,
                z = 1474,
                r = 180
            }
        }
    },
    {
        id = 32,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 47678, 138418, 1572, 0},
        text = { 47684, 138294, 1574 },
        doors = {
            {
                entity = -1,
                model = 55,
                x = 47757,
                y = 138325,
                z = 1474,
                r = 180
            }
        }
    },
    {
        id = 33,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 46877, 138410, 1572, 0},
        text = { 46881, 138294, 1574 },
        doors = {
            {
                entity = -1,
                model = 55,
                x = 46957,
                y = 138325,
                z = 1474,
                r = 180
            }
        }
    },
    {
        id = 34,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 46081, 138454, 1572, 0},
        text = { 46076, 138294, 1574 },
        doors = {
            {
                entity = -1,
                model = 55,
                x = 46155,
                y = 138325,
                z = 1474,
                r = 180
            }
        }
    },
    {
        id = 35,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -24115, -5507, 2343, 0},
        text = { -23994, -5466, 2345 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -24040.953125,
                y = -5436.2216796875,
                z = 2245.0,
                r = 20
            }
        }
    },
    {
        id = 36,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -23819, -6269, 2343, 0},
        text = { -23717, -6229, 2345 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -23760.482421875,
                y = -6206.7641601563,
                z = 2245.0,
                r = 20
            }
        }
    },
    {
        id = 37,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -23755, -5407, 2343, 0},
        text = { -23652, -6407, 2345 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -23698.90234375,
                y = -6375.904296875,
                z = 2245.0,
                r = 20
            }
        }
    },
    {
        id = 38,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -23488, -7210, 2343, 0},
        text = { -23374, -7169, 2345 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -23418.43359375,
                y = -7146.447265625,
                z = 2245.0,
                r = 20
            }
        }
    },
    {
        id = 39,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -23424, -7380, 2343, 0},
        text = { -23311, -7344, 2345 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -23356.876953125,
                y = -7315.5932617188,
                z = 2245.0,
                r = 20
            }
        }
    },
    {
        id = 40,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -23174, -8155, 2343, 0},
        text = { -23029, -8118, 2345 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -23076.404296875,
                y = -8086.1352539063,
                z = 2245.0,
                r = 20
            }
        }
    },
    {
        id = 41,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -23121, -8332, 2343, 0},
        text = { -22968, -8285, 2345 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -23014.845703125,
                y = -8255.2822265625,
                z = 2245.0,
                r = 20
            }
        }
    },
    {
        id = 42,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -22801, -9090, 2343, 0},
        text = { -22687, -9058, 2345 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -22734.3671875,
                y = -9025.8203125,
                z = 2245.0,
                r = 20
            }
        }
    },
    {
        id = 43,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -22801, -9090, 2343, 0},
        text = { -22687, -9058, 2345 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -22734.3671875,
                y = -9025.8203125,
                z = 2245.0,
                r = 20
            }
        }
    },
    {
        id = 44,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -24115, -5507, 2073, 0},
        text = { -23994, -5466, 2075 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -24040.953125,
                y = -5436.2216796875,
                z = 1975.0,
                r = 20
            }
        }
    },
    {
        id = 45,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -23819, -6269, 2073, 0},
        text = { -23717, -6229, 2075 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -23760.482421875,
                y = -6206.7641601563,
                z = 1975.0,
                r = 20
            }
        }
    },
    {
        id = 46,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -23755, -5407, 2073, 0},
        text = { -23652, -6407, 2075 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -23698.90234375,
                y = -6375.904296875,
                z = 1975.0,
                r = 20
            }
        }
    },
    {
        id = 47,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -23488, -7210, 2073, 0},
        text = { -23374, -7169, 2075 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -23418.43359375,
                y = -7146.447265625,
                z = 1975.0,
                r = 20
            }
        }
    },
    {
        id = 48,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -23424, -7380, 2073, 0},
        text = { -23311, -7344, 2075 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -23356.876953125,
                y = -7315.5932617188,
                z = 1975.0,
                r = 20
            }
        }
    },
    {
        id = 49,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -23174, -8155, 2073, 0},
        text = { -23029, -8118, 2075 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -23076.404296875,
                y = -8086.1352539063,
                z = 1975.0,
                r = 20
            }
        }
    },
    {
        id = 50,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -23121, -8332, 2073, 0},
        text = { -22968, -8285, 2075 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -23014.845703125,
                y = -8255.2822265625,
                z = 1975.0,
                r = 20
            }
        }
    },
    {
        id = 51,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -22801, -9090, 2073, 0},
        text = { -22687, -9058, 2075 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -22734.3671875,
                y = -9025.8203125,
                z = 1975.0,
                r = 20
            }
        }
    },
    {
        id = 52,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -22801, -9090, 2073, 0},
        text = { -22687, -9058, 2075 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -22734.3671875,
                y = -9025.8203125,
                z = 1975.0,
                r = 20
            }
        }
    },
    {
        id = 53,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -25211, -5899, 2343, 0},
        text = { -25357, -5952, 2345 },
        doors = {
            {
                 entity = -1,
                 model = 50,
                 x = -25311.31640625,
                 y = -5982.5869140625,
                 z = 2245.0,
                 r = 200
            }
        }
    },
    {
        id = 54,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -24987, -6691, 2343, 0},
        text = { -25076, -6723, 2345 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -25030.845703125,
                y = -6753.1303710938,
                z = 2245.0,
                r = 200
            }
        }
    },
    {
        id = 55,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -24888, -6845, 2343, 0},
        text = { -25012, -6899, 2345 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -24969.28125,
                y = -6922.2744140625,
                z = 2245.0,
                r = 200
            }
        }
    },
    {
        id = 56,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -24629, -7623, 2343, 0},
        text = { -24735, -7659, 2345 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -24688.818359375,
                y = -7692.8208007813,
                z = 2245.0,
                r = 200
            }
        }
    },
    {
        id = 57,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -24552, -7810, 2343, 0},
        text = { -24677, -7837, 2345 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -24627.255859,
                y = -7861.965820,
                z = 2245.0,
                r = 200
            }
        }
    },
    {
        id = 58,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -24291, -8577, 2343, 0},
        text = { -24393, -8601, 2345 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -24346.783203125,
                y = -8632.505859375,
                z = 2245.0,
                r = 200
            }
        }
    },
    {
        id = 59,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -24218, -8735, 2343, 0},
        text = { -24330, -8774, 2345 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -24285.216796875,
                y = -8801.6494140625,
                z = 2245.0,
                r = 200
            }
        }
    },
    {
        id = 60,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -23970, -9512, 2343, 0},
        text = { -24051, -9540, 2345 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -24004.7578125,
                y = -9572.19140625,
                z = 2245.0,
                r = 200
            }
        }
    },
    {
        id = 61,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -25211, -5899, 2043, 0},
        text = { -25357, -5952, 2045 },
        doors = {
            {
                 entity = -1,
                 model = 50,
                 x = -25311.31640625,
                 y = -5982.5869140625,
                 z = 1975.0,
                 r = 200
            }
        }
    },
    {
        id = 62,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -24987, -6691, 2043, 0},
        text = { -25076, -6723, 2045 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -25030.845703125,
                y = -6753.1303710938,
                z = 1975.0,
                r = 200
            }
        }
    },
    {
        id = 63,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -24888, -6845, 2043, 0},
        text = { -25012, -6899, 2045 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -24969.28125,
                y = -6922.2744140625,
                z = 1975.0,
                r = 200
            }
        }
    },
    {
        id = 64,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -24629, -7623, 2043, 0},
        text = { -24735, -7659, 2045 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -24688.818359375,
                y = -7692.8208007813,
                z = 1975.0,
                r = 200
            }
        }
    },
    {
        id = 65,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -24552, -7810, 2043, 0},
        text = { -24677, -7837, 2045 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -24627.255859,
                y = -7861.965820,
                z = 1975.0,
                r = 200
            }
        }
    },
    {
        id = 66,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -24291, -8577, 2043, 0},
        text = { -24393, -8601, 2045 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -24346.783203125,
                y = -8632.505859375,
                z = 1975.0,
                r = 200
            }
        }
    },
    {
        id = 67,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -24218, -8735, 2043, 0},
        text = { -24330, -8774, 2045 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -24285.216796875,
                y = -8801.6494140625,
                z = 1975.0,
                r = 200
            }
        }
    },
    {
        id = 68,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -23970, -9512, 2043, 0},
        text = { -24051, -9540, 2045 },
        doors = {
            {
                entity = -1,
                model = 50,
                x = -24004.7578125,
                y = -9572.19140625,
                z = 1975.0,
                r = 200
            }
        }
    },
    {
        id = 69,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 216331, 166735, 1389, 0},
        text = { 216335, 166735, 1397 },
        doors = {
            {
                entity = -1,
                model = 23,
                x = 216289.0,
                y = 166768.0,
                z = 1297.0,
                r = 90
            },
            {
                entity = -1,
                model = 24,
                x = 216138.0,
                y = 167899.0,
                z = 1297.0,
                r = -90
            },
            {
                entity = -1,
                model = 21,
                x = 216178.0,
                y = 168302.0,
                z = 1297.0,
                r = -90
            },
            {
                entity = -1,
                model = 41,
                x = 214824.0,
                y = 166962.0,
                z = 1215.0,
                r = 0
            }
        }
    },
    {
        id = 70,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 212924, 167134, 1399, 0},
        text = { 212782, 166947, 1400 },
        doors = {
            {
                entity = -1,
                model = 23,
                x = 212728.0,
                y = 166980.0,
                z = 1300.0,
                r = 90
            },
            {
                entity = -1,
                model = 24,
                x = 212683.0,
                y = 167192.0,
                z = 1301.0,
                r = 0
            },
            {
                entity = -1,
                model = 22,
                x = 213177.0,
                y = 167813.0,
                z = 1301.0,
                r = -90
            },
            {
                entity = -1,
                model = 41,
                x = 211319.0,
                y = 166962.0,
                z = 1215.0,
                r = 0
            }
        }
    },
    {
        id = 71,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 215599, 171999, 1392, 0},
        text = { 215594, 172208, 1395 },
        doors = {
            {
                entity = -1,
                model = 23,
                x = 215638.0,
                y = 172176.0,
                z = 1295.0,
                r = -90
            },
            {
                entity = -1,
                model = 24,
                x = 214773.0,
                y = 171476.0,
                z = 1295.0,
                r = -90
            },
            {
                entity = -1,
                model = 41,
                x = 217059.0,
                y = 171935.0,
                z = 1215.0,
                r = 180
            }
        }
    },
    {
        id = 72,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 211890, 171806, 1401, 0},
        text = { 212052, 171976, 1402 },
        doors = {
            {
                entity = -1,
                model = 23,
                x = 212094.0,
                y = 171944.0,
                z = 1302.0,
                r = -90
            },
            {
                entity = -1,
                model = 24,
                x = 212141.0,
                y = 171732.0,
                z = 1303.0,
                r = 180
            },
            {
                entity = -1,
                model = 22,
                x = 211646.0,
                y = 171114.0,
                z = 1303.0,
                r = 90
            },
            {
                entity = -1,
                model = 41,
                x = 213558.0,
                y = 171935.0,
                z = 1215.0,
                r = 180
            }
        }
    },
    {
        id = 73,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 162822, 211600, 1403 },
        text = { 162822, 211679, 1402 },
        doors = {
            {
                entity = -1,
                model = 23,
                x = 162870.0,
                y = 211647.0,
                z = 1313.0,
                r = -90
            },
            {
                entity = -1,
                model = 24,
                x = 163233.0,
                y = 211441.0,
                z = 1313.0,
                r = 180
            }
        }
    },
    -- Ajouté par Soljian
    -- CITY
    {
        id = 74,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 158949, 211510, 1493 },
        text = { 159132, 211694, 1390 },
        doors = {
            {
                entity = -1,
                model = 23,
                x = 159179,
                y = 211638,
                z = 1295,
                r = -90
            },
            {
                entity = -1,
                model = 24,
                x = 159122,
                y = 210974,
                z = 1295,
                r = -180
            },
            {
                entity = -1,
                model = 41,
                x = 160607,
                y = 211848,
                z = 1245,
                r = 180
            }
        }
    },
    {
        id = 75,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 163614, 215403, 1509 },
        text = { 163461, 215177, 1402 },
        doors = {
            {
                entity = -1,
                model = 21,
                x = 163420,
                y = 215213,
                z = 1311,
                r = 90
            },
            {
                entity = -1,
                model = 24,
                x = 163477,
                y = 215877,
                z = 1312,
                r = 0
            },
            {
                entity = -1,
                model = 41,
                x = 161978,
                y = 215099,
                z = 1245,
                r = 0
            }
        }
    },
    {
        id = 76,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 159322, 215371, 1407 },
        text = { 159164, 215195, 1396 },
        doors = {
            {
                entity = -1,
                model = 23,
                x = 159112,
                y = 215228,
                z = 1309,
                r = 90
            },
            {
                entity = -1,
                model = 24,
                x = 159354,
                y = 215701,
                z = 1309,
                r = 0
            }
        }
    },
    {
        id = 77,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 155287, 215647, 1510 },
        text = { 155465, 215522, 1398 },
        doors = {
            {
                entity = -1,
                model = 23,
                x = 155434,
                y = 215472,
                z = 1314,
                r = -180
            },
            {
                entity = -1,
                model = 24,
                x = 155152,
                y = 215273,
                z = 1313,
                r = -180
            },
            {
                entity = -1,
                model = 22,
                x = 154456,
                y = 215781,
                z = 1314,
                r = 0
            },
            {
                entity = -1,
                model = 25,
                x = 154919,
                y = 215779,
                z = 1036,
                r = 0
            },
            {
                entity = -1,
                model = 41,
                x = 155309,
                y = 217108,
                z = 1245,
                r = 90
            },
        }
    },
    {
        id = 78,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 158982, 218650, 1509 },
        text = { 159120, 218784, 1398 },
        doors = {
            {
                entity = -1,
                model = 23,
                x = 159174,
                y = 218746,
                z = 1312,
                r = -90
            },
            {
                entity = -1,
                model = 24,
                x = 159116,
                y = 217933,
                z = 1312,
                r = 180
            },
            {
                entity = -1,
                model = 41,
                x = 160614,
                y = 218698,
                z = 1245,
                r = 180
            },
        }
    },
    {
        id = 79,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 158980, 222779, 1507 },
        text = { 158759, 222933, 1396 },
        doors = {
            {
                entity = -1,
                model = 21,
                x = 158792,
                y = 222885,
                z = 1309,
                r = 180
            },
            {
                entity = -1,
                model = 24,
                x = 159921,
                y = 222735,
                z = 1309,
                r = 0
            },
            {
                entity = -1,
                model = 22,
                x = 160322,
                y = 222774,
                z = 1309,
                r = 0
            },
        }
    },
    {
        id = 80,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 162361, 222520, 1507 },
        text = { 162203, 222328, 1400 },
        doors = {
            {
                entity = -1,
                model = 23,
                x = 162157,
                y = 222370,
                z = 1309,
                r = 90
            },
            {
                entity = -1,
                model = 24,
                x = 162465,
                y = 223340,
                z = 1309,
                r = -90
            },
        }
    },
    {
        id = 81,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 164995, 222224, 1506 },
        text = { 164860, 222092, 1396 },
        doors = {
            {
                entity = -1,
                model = 23,
                x = 164809,
                y = 222136,
                z = 1308,
                r = 90
            },
            {
                entity = -1,
                model = 24,
                x = 164758,
                y = 222527,
                z = 1308,
                r = 0
            },
        }
    },
    {
        id = 82,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 165153, 218605, 1514 },
        text = { 165285, 218826, 1397 },
        doors = {
            {
                entity = -1,
                model = 23,
                x = 165337,
                y = 218768,
                z = 1316,
                r = -90
            },
            {
                entity = -1,
                model = 41,
                x = 166781,
                y = 218698,
                z = 1245,
                r = 180
            },
        }
    },
    {
        id = 83,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { 168877, 222381, 1497 },
        text = { 168728, 222226, 1396 },
        doors = {
            {
                entity = -1,
                model = 23,
                x = 168685,
                y = 222265,
                z = 1300,
                r = 90
            },
            {
                entity = -1,
                model = 24,
                x = 169552,
                y = 222965,
                z = 1300,
                r = 90
            },
            {
                entity = -1,
                model = 24,
                x = 169180,
                y = 222923,
                z = 1637,
                r = 180
            },
            {
                entity = -1,
                model = 24,
                x = 168702,
                y = 222685,
                z = 1637,
                r = 90
            },
            {
                entity = -1,
                model = 41,
                x = 167559,
                y = 221959,
                z = 1245,
                r = 0
            },
        }
    },
    -- WAREHOUSES (Desert town)
    {
        id = 84,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -27575, 4224, 2266 },
        text = { -27343, 4078, 2160 },
        doors = {
            {
                entity = -1,
                model = 20,
                x = -27359,
                y = 4023,
                z = 2068,
                r = 200
            },
            {
                entity = -1,
                model = 24,
                x = -27539,
                y = 3908,
                z = 2067,
                r = 110
            },
            {
                entity = -1,
                model = 41,
                x = -25864,
                y = 4765,
                z = 1958,
                r = 20
            },
            {
                entity = -1,
                model = 54,
                x = -26797,
                y = 3300,
                z = 2014,
                r = 20
            },
        }
    },
    {
        id = 85,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -25541, -789, 2262 },
        text = { -25736, -667, 2160 },
        doors = {
            {
                entity = -1,
                model = 20,
                x = -25719,
                y = -615,
                z = 2065,
                r = 20
            },
            {
                entity = -1,
                model = 24,
                x = -25538,
                y = -500,
                z = 2065,
                r = -70
            },
            {
                entity = -1,
                model = 21,
                x = -24787,
                y = -753,
                z = 2065,
                r = -160
            },
            {
                entity = -1,
                model = 41,
                x = -26143,
                y = 709,
                z = 1978,
                r = -70
            },
            {
                entity = -1,
                model = 54,
                x = -26633,
                y = -1060,
                z = 2014,
                r = 110
            },
        }
    },
    {
        id = 86,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -30213, -1958, 2260 },
        text = { -30109, -1759, 2160 },
        doors = {
            {
                entity = -1,
                model = 20,
                x = -30048,
                y = -1784,
                z = 2064,
                r = -70
            },
            {
                entity = -1,
                model = 21,
                x = -29420,
                y = -3184,
                z = 2065,
                r = 110
            },
            {
                entity = -1,
                model = 24,
                x = -29520,
                y = -2795,
                z = 2064,
                r = 110
            },
            {
                entity = -1,
                model = 41,
                x = -31693,
                y = -2401,
                z = 1965,
                r = -160
            },
        }
    },
    {
        id = 87,
        price = 100000,
        lock = true,
        spawnable = 0,
        owner = 0,
        spawn = { -29215, -7850, 2263 },
        text = { -29407, -7778, 2160 },
        doors = {
            {
                entity = -1,
                model = 21,
                x = -29388,
                y = -7724,
                z = 2064,
                r = 20
            },
            {
                entity = -1,
                model = 24,
                x = -29203,
                y = -7612,
                z = 2064,
                r = -70
            },
        }
    },
}

function OnPackageStart()
    -- Save all player data automatically
    CreateTimer(function()
		for k,v in pairs(houses) do
            SaveHouseData(k)

        end
    end, 30000)

    -- for k,v in pairs(houses) do -- Pour voir les maisons déjà faites de loin, ne pas tenir compte
    --     CreateObject(2, v.spawn[1],v.spawn[2],v.spawn[3]+1000, 0, 0, 0, 5, 5, 5)
    -- end

end
AddEvent("OnPackageStart", OnPackageStart)

function getHouseDoor(door)
    for k,v in pairs(houses) do
        for i,j in pairs(v.doors) do
            if j.entity == door then
                return k
            end
        end
    end
    return 0
end

function getHouseID(id)
    for k,v in pairs(houses) do
        if v.id == id then
            return k
        end
    end
    return 0
end

function getHouseOwner(player)
    for k,v in pairs(houses) do
        if v.owner == tonumber(PlayerData[player].accountid) then
            return k
        end
    end
    return 0
end

AddEvent("database:connected", function()
    mariadb_query(sql, "SELECT * FROM player_house;", function()
        for i=1,mariadb_get_row_count() do
            local result = mariadb_get_assoc(i)
            local id = getHouseID(tonumber(result['id']))


            houses[id].owner = tonumber(result['ownerid'])
            houses[id].spawnable = tonumber(result['spawn'])

            if houses[id].owner == 0 then
                houses[id].txtentities = {
                    CreateText3D( _("house_id").." "..houses[id].id, 10, houses[id].text[1] , houses[id].text[2], houses[id].text[3]+20, 0, 0, 0 ),
                    CreateText3D( _("price").." "..houses[id].price.._("currency"), 10, houses[id].text[1] , houses[id].text[2], houses[id].text[3], 0, 0, 0 )
                }
            else
                mariadb_query(sql, "SELECT name FROM accounts WHERE id='"..houses[id].owner.."';", function()
                    houses[id].txtentities = {
                        CreateText3D( _("house_id").." "..houses[id].id, 10, houses[id].text[1] , houses[id].text[2], houses[id].text[3]+20, 0, 0, 0 ),
                        CreateText3D( _("owner").." "..mariadb_get_value_name(1, "name"), 10, houses[id].text[1] , houses[id].text[2], houses[id].text[3], 0, 0, 0 )
                    }
                end)
            end
        end
    end)

end)

AddRemoteEvent("interactHouse", function(player, door)
    local house = getHouseDoor(door)

    if houses == 0 then
        return
    end

    if houses[house].owner == 0 then
        CallRemoteEvent(player, "OpenHouseBuy", house, houses[house].price)
    else
        if houses[house].owner == tonumber(PlayerData[player].accountid) then
            CallRemoteEvent(player, "OpenHouseMenu", house, houses[house].price)
        end
    end
end)


AddEvent("OnPackageStart", function()
    for k,v in pairs(houses) do
        for k,v in pairs(v.doors) do
            v.entity = CreateDoor( v.model, v.x, v.y, v.z, v.r, true )
        end
    end
end)

AddEvent("OnPlayerInteractDoor", function( player, door, bWantsOpen )
    local house = getHouseDoor(door)
    if house == 0 then
        SetDoorOpen(door, not IsDoorOpen(door))
    else
        if not houses[house].lock then
            SetDoorOpen(door, not IsDoorOpen(door))
        end
    end
end)

AddRemoteEvent("BuyHouse", function(player, house)
    if GetPlayerCash(player) < houses[house].price then
        return CallRemoteEvent(player, "MakeNotification", _("not_enought_cash"), "linear-gradient(to right, #ff5f6d, #ffc371)")
    end

    if getHouseOwner(player) ~= 0 then
        CallRemoteEvent(player, "MakeNotification", _("already_house_owner"), "linear-gradient(to right, #ff5f6d, #ffc371)")
    else
        RemovePlayerCash(player, houses[house].price)
        houses[house].owner = tonumber(PlayerData[player].accountid)
        DestroyText3D(houses[house].txtentities[2])
        houses[house].txtentities[2] = CreateText3D( _("owner").." "..PlayerData[player].name, 10, houses[house].text[1] , houses[house].text[2], houses[house].text[3], 0, 0, 0 )
    end
end)

AddRemoteEvent("UnlockHouse", function(player, house)
    if houses[house].owner == tonumber(PlayerData[player].accountid) then
        if houses[house].lock then
            houses[house].lock = false
            CallRemoteEvent(player, "MakeNotification", _("unlock_house"), "linear-gradient(to right, #00b09b, #96c93d)")
        else
            houses[house].lock = true
            CallRemoteEvent(player, "MakeNotification", _("lock_house"), "linear-gradient(to right, #00b09b, #96c93d)")
        end
    end
end)

AddRemoteEvent("SellHouse", function(player, house)
    if houses[house].owner == tonumber(PlayerData[player].accountid) then
        price = math.ceil(houses[house].price * 0.25)
        AddPlayerCash(player, price)
        houses[house].owner = 0
        CallRemoteEvent(player, "MakeNotification", _("house_sell", price, _("currency")), "linear-gradient(to right, #00b09b, #96c93d)")
        DestroyText3D(houses[house].txtentities[2])
        houses[house].txtentities[2] = CreateText3D( _("price").." "..houses[house].price.._("currency"), 10, houses[house].text[1] , houses[house].text[2], houses[house].text[3], 0, 0, 0 )
    end
end)

AddRemoteEvent("SetHouseSpawn", function(player, house)
    if houses[house].owner == tonumber(PlayerData[player].accountid) then
        if houses[house].spawnable == 1 then
            CallRemoteEvent(player, "MakeNotification", _("default_spawn"), "linear-gradient(to right, #00b09b, #96c93d)")
            houses[house].spawnable = 0
        else
            CallRemoteEvent(player, "MakeNotification", _("house_spawn"), "linear-gradient(to right, #00b09b, #96c93d)")
            houses[house].spawnable = 1
        end
    end
end)

function SaveHouseData(house)
    local query = mariadb_prepare(sql, "UPDATE player_house SET ownerid = '?', spawn = '?' WHERE id = '?' LIMIT 1;",
    houses[house].owner,
    houses[house].spawnable,
    houses[house].id
    )

mariadb_query(sql, query)
end

function GetNearestHouseDoor(player)
    local x, y, z = GetPlayerLocation(player)

    for k,v in pairs(houses) do
            for i,j in pairs(v.doors) do
                local x2, y2, z2 = GetDoorLocation( j.entity )
                local dist = GetDistance3D(x, y, z, x2, y2, z2)
                if dist < 150.0 then
                    return j.entity
                end
            end
        end
    return 0
end
