Simple Miner Minigame [Standalone] [FREE]

Explanation:

Often times, being a miner is something very boring when you just have to go to a few markings and then press a key and then perform an animation. So, to make a difference to that, we created this simple minigame for miners. There are two minigames that are very easy to use and that work on any server. To use them, you’ll just have to call the event that opens the mini game on the player’s screen.

Features:

  • Works on any server.
  • You can translate texts easily in the Config.lua file
  • Contains 2 puzzles.
  • You can set the difficulty of the bar in puzzle 1.
  • The puzzle bar 1 decreases if the player doesn’t keep pressing Space.
  • You will be able to define how many cars will have in puzzle 2
  • You can set the speed and spawn time of the car in puzzle 2.

Puzzle 1: remove the stones from the mine path

Puzzle 2: get the ore carts

How to use:

For the first mini game, you can open it by calling the event “lg_puzzleminer:Open_1” which is on the client side.

Example of how to open the first mini game with a difficulty of 2:
Note: difficulty 1 is the hardest of all.

TriggerEvent("lg_puzzleminer:Open_1", 2, function(result)
        if result.success then
            -- Here you define what happens when you complete the first mini game.
        else
            -- Here you define what happens when the player cancels the first mini game
        end
end)

To open the second mini game, you can open it by calling the event: “lg_puzzleminer:Open_2” which is on the client side.

Example of how to open the second mini game, with 10 carts, speed equal to 80 and cart spawn time equal to 1000 milliseconds (1 second).
In this event, you can also check when carts the player has picked up, using result.amount.

TriggerEvent("lg_puzzleminer:Open_2", 10, 80, 1000, function(result)
        if result.success then
            -- Here you define what happens when you complete the second mini game.
            print("You completed the second puzzle and you got this amount of carts: " .. result.amount)
        else
            -- Here you define what happens when the player cancels the second mini game
            print("You canceled the second puzzle")
        end
    end)

Resmon:

The maximum captured was 0.02ms when the puzzle was open.
resmon

Demonstration:

Puzzle 1:
https://imgur.com/ksVlzx4.gif

Puzzle 2:
https://imgur.com/N8SgpFK.gif

See our other scripts:
NPC Driver - AI Driver (Taxi, Uber, Limousine, Motorcycle and Boat)
Clipboard For Jobs
Police Report - Remake
Manage Your own Store Remake
Documents System
Market Between Players Remake
Trade System
Luck Games
Simple Leaderboard
Vending Machine
Forms in Game
SuperMarket and Stores
Album Photos
Reason for Vehicle Seizure
Crew System
Advanced Illegal Tablet
Admin Spawnner Props Objects
Simple Menu Creator with Icons
A simple Medical Card for Hospital

Download:
PuzzleMiner.zip (934.1 KB)

4 Likes

Here is the download so people dont have to give there data to download a free resource that should already be hosted on fivem forums or github…
PuzzleMiner.zip (934.4 KB)

4 Likes

Free resources must be uploaded to the forums or GitHub

Fixed :wink:

Quite a nice resource, good job!

1 Like

Thank you !! :slight_smile:

The minigame is simple but idk. Funny :smiley:

1 Like

That’s great ! Glead to hear it :grinning_face_with_smiling_eyes: :two_hearts:

Can i have your discord to ask something about minigame? :cry: it’s hard with me to setup

1 Like

Hey, could you write it right here in the topic or in the private forum? I will help you with whatever you need :slight_smile:

local isMining = false

RegisterNetEvent(‘lg_puzzleminer:Open_1’)
AddEventHandler(‘lg_puzzleminer:Open_1’, function(difficulty, callback)
TriggerEvent(“lg_puzzleminer:Open_1”, difficulty, function(result)
if result.success then
callback(true) – Gọi hàm callback với kết quả thành công
else
callback(false) – Gọi hàm callback với kết quả thất bại
end
end)
end)

RegisterNetEvent(‘jim-mining:MineOre:Pick’)
AddEventHandler(‘jim-mining:MineOre:Pick’, function(data)
if isMining then return else isMining = true end – Stop players from doubling up the event

TriggerEvent('lg_puzzleminer:Open_1', 2, function(result)
    if result then
        -- Success
        QBCore.Functions.Notify("Thành công", "success")
        TriggerServerEvent('jim-mining:MineReward')
        -- Các hành động khác sau khi hoàn thành mini game
    else
        -- end minigame
        QBCore.Functions.Notify("Thất bại", "error")
        
    end

    isMining = false
end)

end)

I tried to add your minigame to my jim-minejob but it’s not work. When i target the stone the game be cracked!

Hey my friend. Sorry for the delay in responding. But notice that in your code, you made an infinite LOOP.

When you create the event:

RegisterNetEvent('lg_puzzleminer:Open_1')
AddEventHandler('lg_puzzleminer:Open_1', function(difficulty, callback)

you added a call to the event itself:

TriggerEvent(“lg_puzzleminer:Open_1”, difficulty, function(result)

This means that when entering the event, it calls itself, and this happens infinitely. Thus, the game crashes, because it did not support this infinite call.

Now let’s talk about how you can fix this.
You don’t need to register the lg_puzzleminer:Open_1 event as it is already registered in the lg_puzzleminer script.

You just need to use the code below:

local isMining = false

RegisterNetEvent("jim-mining:MineOre:Pick")
AddEventHandler("jim-mining:MineOre:Pick", function(data)
        if isMining then 
                return -- Stop players from doubling up the event
        else 
                isMining = true 
        end

        TriggerEvent('lg_puzzleminer:Open_1', 2, function(result)
                if result then
                        -- Success
                        QBCore.Functions.Notify("Thành công", "success")
                        TriggerServerEvent('jim-mining:MineReward')
                -- Các hành động khác sau khi hoàn thành mini game
                else
                        -- end minigame
                        QBCore.Functions.Notify("Thất bại", "error")
        
                end

                isMining = false
        end)
end)

Just use this code snippet, and it will work :slight_smile:

If there is any problem, let us know and we will help you.