sv_utils.lua

CORE = exports["ak4y-core"]

CORE:Register('ak4y-spawn:GetHouseLocs', function(source)
    local src = source
    local myhouses = {}
    local citizenId = CORE:GetCitizenId(src)

    local houses = CORE:ExecuteSql("SELECT * FROM player_houses WHERE citizenid = '" .. citizenId .. "'")
    if houses[1] then
        for k,v in pairs(houses) do
            local house = CORE:ExecuteSql("SELECT * FROM houselocations WHERE name = '" .. v.house .. "'")
            if house[1] then
                myhouses[#myhouses + 1] = {
                    coords = json.decode(house[1].coords).enter,
                    name = house[1].label,
                    id = house[1].id,
                }
            end
        end
    end
    return myhouses
end)

function IsPlayerAdmin(playerid)
    return IsPlayerAceAllowed(playerid, "admin")
end

Last updated