example
example

资源 类似 nopixel 4.0 的开锁小游戏

Yann

站长
管理成员
GTAOS管理组
认证卖家
认证用户
本 月 名 人 榜 最 佳

1725856962222.png
外部撬锁器 1

qb-vehiclekeys 使用

步骤 1:删除 qb-lockpick

步骤 2:遵循以下说明


在 qb-vehiclekeys/client/main.lua 中搜索

旧存储库 qb-vehiclekeys


lua:
RegisterNetEvent('lockpicks:UseLockpick', function(isAdvanced)
    LockpickDoor(isAdvanced)
end)
对于新存储库 qb-vehiclekeys
lua:
RegisterNetEvent('lockpicks:UseLockpick', function(isAdvanced)
    local ped = PlayerPedId()
    local pos = GetEntityCoords(ped)
    local vehicle = QBCore.Functions.GetClosestVehicle()

    if vehicle == nil or vehicle == 0 then return end
    if HasKeys(QBCore.Functions.GetPlate(vehicle)) then return end
    if #(pos - GetEntityCoords(vehicle)) > 2.5 then return end
    if GetVehicleDoorLockStatus(vehicle) <= 0 then return end

    local difficulty = isAdvanced and 'easy' or 'medium' -- Easy for advanced lockpick, medium by default
    local success = exports['qb-minigames']:Skillbar(difficulty)

    local chance = math.random()
    if success then
        TriggerServerEvent('hud:server:GainStress', math.random(1, 4))
        lastPickedVehicle = vehicle

        if GetPedInVehicleSeat(vehicle, -1) == PlayerPedId() then
            TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys', QBCore.Functions.GetPlate(vehicle))
        else
            QBCore.Functions.Notify(Lang:t('notify.vlockpick'), 'success')
            TriggerServerEvent('qb-vehiclekeys:server:setVehLockState', NetworkGetNetworkIdFromEntity(vehicle), 1)
        end
    else
        TriggerServerEvent('hud:server:GainStress', math.random(1, 4))
        AttemptPoliceAlert('steal')
    end

    if isAdvanced then
        if chance <= Config.RemoveLockpickAdvanced then
            TriggerServerEvent('qb-vehiclekeys:server:breakLockpick', 'advancedlockpick')
        end
    else
        if chance <= Config.RemoveLockpickNormal then
            TriggerServerEvent('qb-vehiclekeys:server:breakLockpick', 'lockpick')
        end
    end
end)
并替换为以下代码
lua:
RegisterNetEvent('lockpicks:UseLockpick', function(isAdvanced)
    local ped = PlayerPedId()
    local pos = GetEntityCoords(ped)
    local vehicle = QBCore.Functions.GetClosestVehicle()

    if vehicle == nil or vehicle == 0 then return end
    if HasKeys(QBCore.Functions.GetPlate(vehicle)) then return end
    if #(pos - GetEntityCoords(vehicle)) > 2.5 then return end
    if GetVehicleDoorLockStatus(vehicle) <= 0 then return end

    -- Corrected the resource name in the call
    exports['exter-lockpick']:OpenLockpickMinigame(function(success)
        if success then
            -- Logic for successful lockpicking
            TriggerServerEvent('hud:server:GainStress', math.random(1, 4))
            lastPickedVehicle = vehicle

            if GetPedInVehicleSeat(vehicle, -1) == PlayerPedId() then
                TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys', QBCore.Functions.GetPlate(vehicle))
            else
                QBCore.Functions.Notify(Lang:t("notify.vlockpick"), 'success')
                TriggerServerEvent('qb-vehiclekeys:server:setVehLockState', NetworkGetNetworkIdFromEntity(vehicle), 1)
            end
        else
            -- Logic for failed lockpicking
            TriggerServerEvent('hud:server:GainStress', math.random(1, 4))
            AttemptPoliceAlert("steal")
        end
    end, vehicle, isAdvanced and 'advanced' or 'normal')  -- Adjust parameters as needed
end)

为了让游戏更短/更快,请从 client.lua 中的 OpenDevice 函数调整时间

请参阅以下时间调整示例
lua:
function OpenDevice(successCallback, target, time)
    SetNuiFocus(true, true)
    time = 50  -- Change to suit your needs
    SendNUIMessage({type = "open", target = target, time = time})

原始存储库在此处

NoPixel-迷你游戏-4.0
 
顶部