[FREE][STANDALONE] QB-Lock Rework (2nd version)

image
image
image

TEBEX

GITHUB

Template

exports[‘qb-lock’]:StartLockPickCircle(amount, time, function(success)

Example useage

RegisterCommand(“lpgame”, function()
local time = math.random(7,10)
local circles = math.random(2,4)
local success = exports[‘qb-lock’]:StartLockPickCircle(circles, time, success) print(success)
if success then print(“WIN”) else print(“FAIL”) end
end)

Useful Snippet

for everyone here that wants to add the minigame to other script in a very simple way

local seconds = math.random(9,12)
local circles = math.random(1,3)
local success = exports[‘qb-lock’]:StartLockPickCircle(circles, seconds, success)
if success then QBCore.Functions.Notify(" Success", “success”) end

Other Scripts:
[STANDALONE] V-VehicleCamShake
[STANDALONE] V-CameraControls

Code is accessible Yes
Subscription-based No
Lines (approximately) 400
Requirements None
Support Yes
2 Likes

How to change the spin direction?

inside of script.js try changing this

document.addEventListener("keydown", function(ev) {
    let key_pressed = ev.key;
    let valid_keys = ['1','2','3','4'];
    if( valid_keys.includes(key_pressed) ){
        if( key_pressed === key_to_press ){
            let d_start = (180 / Math.PI) * g_start;
            let d_end = (180 / Math.PI) * g_end;
            if( degrees < d_start ){
                wrong();
            }else if( degrees > d_end ){
                wrong();
            }else{
                correct();
            }
        }else{
            wrong();
        }
    }
});

to this:

document.addEventListener("keydown", function(ev) {
    let key_pressed = ev.key;
    let valid_keys = ['1', '2', '3', '4'];
    if (valid_keys.includes(key_pressed)) {
        if (key_pressed === key_to_press) {
            let d_start = (180 / Math.PI) * g_start;
            let d_end = (180 / Math.PI) * g_end;

            if (degrees > d_start && degrees < d_end || degrees + 360 > d_start && degrees + 360 < d_end) {
                correct();
            } else {
                wrong();
            }
        } else {
            wrong();
        }
    }
});

then change this

function animate_to() {
    if (degrees >= new_degrees) {
        wrong();
        return;
    }
    degrees+=2;
    init();
}

to this

function animate_to() {
    if (degrees <= -new_degrees) {
        wrong();
        return;
    }
    degrees -= 2;
    init();
}

Will you fix a direct link for download?

Yes I just added a github link