client/editable.lua

function isPlayerAdmin()
    return PlayerData and PlayerData and PlayerData.perm ~= "user"
end

function isPolice(job)
    for i = 1, #config.weaponPoliceJobs do
        if config.weaponPoliceJobs[i] == job then
            return true
        end
    end
    return false
end

function hotbarIsOpenEditable(bool)
    TriggerEvent("tgiann-inventory:hotbar", bool)
end

function canOpen()
    if not PlayerData then PlayerData = exports["tgiann-core"]:getPlayerData() end
    return not IsNuiFocused() and not IsDisabledControlPressed(0, 19) and inventoryActive and not isDead and not IsPauseMenuActive() and playerLoaded
    --return not IsNuiFocused() and not IsDisabledControlPressed(0, 19) and inventoryActive and not isDead and not IsPauseMenuActive() and not PlayerData.metadata["kelepce"] and not PlayerData.metadata["pkelepce"]
end

function emote(text, type)
    ExecuteCommand("me " .. text)
end

RegisterNetEvent('tgiann-inventory:emote')
AddEventHandler('tgiann-inventory:emote', emote)

function opened()
    TriggerEvent("tgiann-hud:ui", false)
    TriggerEvent("tgiann-lumihud:ui", false)
end

function closed()
    TriggerEvent("tgiann-hud:ui", true)
    TriggerEvent("tgiann-lumihud:ui", true)
end

function disableClotheButton()
    --[[  local onDuty = false
    if PlayerData.job.name == "police" then
        onDuty = PlayerData.job.onduty
    end
    return onDuty or (exports["tgiann-event"]:joinedAnyEvent() and true or false ) or exports["tgiann-clothing"]:isInspect() ]]
    return false
end

function getTrunkData(vehicle)
    local class = GetVehicleClass(vehicle)
    local maxweight, slots
    if class == 0 then -- Compacts
        maxweight = 50000
        slots = 10
    elseif class == 1 then -- Sedans
        maxweight = 50000
        slots = 10
    elseif class == 2 or class == 9 then -- SUVs, Off-road
        maxweight = 250000
        slots = 10
    elseif class == 12 then -- vans
        maxweight = 450000
        slots = 20
    elseif class == 20 then -- commercial
        maxweight = 800000
        slots = 40
    elseif class == 3 or class == 4 then -- Coupes, Muscle
        maxweight = 25000
        slots = 10
    elseif class == 13 or class == 8 then -- Cycles
        maxweight = 2000
        slots = 1
    elseif class == 5 then -- Sports Classics
        maxweight = 12000
        slots = 10
    elseif class == 6 then -- Sports
        maxweight = 10000
        slots = 10
    elseif class == 7 then -- Super
        maxweight = 8000
        slots = 5
    elseif class == 11 then -- Super
        maxweight = 10000
        slots = 5
    else
        maxweight = 25000
        slots = 10
    end

    --[[     if string.match(tgiCore.trim(GetVehicleNumberPlateText(vehicle)), "%d%d%d%S%S%S%d%d") == nil then
        maxweight = 5000
        slots = 1
    end ]]

    if GetEntityModel(vehicle) == `bcat` then
        maxweight = 10000000
        slots = 200
    end

    return {
        maxweight = maxweight,
        slots = slots,
    }
end

function removeWeaponCustom()
    --[[ if exports["tgiann-pvpinventory"]:isActive() then
        SetCurrentWeapon()
        return true
    end ]]
    return false
end

function dropWeaponWhenDieEditable()
    --[[ local zoneIsRed = exports["tgiann-safezone"]:getZoneType() == "red"
    if zoneIsRed and exports["tgiann-police"]:playerIsPolice() then
        return
    end

    if zoneIsRed and PlayerData.metadata.vip.level == 2 and math.random(1, 100) >= 50 then -- 2 Level VIP Özelliği %50 silah düşme oranı
        TriggerEvent("inventory:client:removeWeapon")
        return
    end ]]

    return true
end

function setPlayerStatus(status)
    if config.framework == "esx" then
        if status.hunger then
            TriggerEvent("esx_status:getStatus", "hunger", function(value)
                value.set(value.val + status.hunger)
            end)
        end
        if status.thirst then
            TriggerEvent("esx_status:getStatus", "thirst", function(value)
                value.set(value.val + status.thirst)
            end)
        end
    elseif config.framework == "qb" then
        if status.hunger then
            TriggerServerEvent("consumables:server:addHunger", tgiCore.core.Functions.GetPlayerData().metadata.hunger + status.hunger)
        end
        if status.thirst then
            TriggerServerEvent("consumables:server:addThirst", tgiCore.core.Functions.GetPlayerData().metadata.thirst + status.thirst)
        end
    end
end

Last updated