Skip to content

Minigames ​

gsd-minigames · Free · Requires GSD Bridge

Six clean, modern minigames for your scripts - one line of code to use.

The games ​

GameExportHow it plays
Skill checkSkillCheckA needle runs around a ring. Press the key while it is in the red zone; the white part is a perfect hit. It gets faster after every hit.
Key sequenceKeySequencePress the shown letters in order. Every key has its own short time.
LockpickLockpickMove the pick with A / D or the mouse, hold Space to turn the lock. The closer the pick is to the sweet spot, the further the lock turns. Forcing it at a wrong spot wears the pick out until it breaks.
SafeSafeCrackTurn the dial with A / D or the mouse wheel. It clicks on the right number: press the key to lock it in.
Hold steadyHoldSteadyKeep the marker inside a wandering zone with A / D until the bar is full.
MashMashPress the key as fast as you can to fill the bar before the time runs out.
  • Three difficulties for every game (easy, medium, hard) - every value can be changed in config.lua.
  • Sounds are built in (generated, no sound files).
  • Backspace or Escape cancels a game (counts as failed). The game also stops if the player dies.
  • Languages: English, Hungarian, German.

Requirements ​

  • GSD Bridge - free.
  • VORP, RSG or a custom core set up in GSD Bridge.

Installation ​

  1. Put the gsd-minigames folder into your resources folder.

  2. Add it to your server.cfg after gsd-bridge:

    bash
    ensure gsd-bridge
    ensure gsd-minigames
  3. Restart the server.

  4. Test it in game as an admin: /minigames lockpick hard

Using it in your scripts ​

Every export waits until the game is over and returns true (success) or false (failed, cancelled, player died, or another game is already running). Use them on the client.

lua
local ok = exports['gsd-minigames']:Lockpick('medium')
if ok then
    -- open the door
end
ExportReturns
SkillCheck(difficulty?, options?)true / false
KeySequence(difficulty?, options?)true / false
Lockpick(difficulty?, options?)true / false
SafeCrack(difficulty?, options?)true / false
HoldSteady(difficulty?, options?)true / false
Mash(difficulty?, options?)true / false
Start(game, difficulty?, options?)true / false - game: 'skill', 'keys', 'lockpick', 'safe', 'steady', 'mash'
IsBusy()true while a game is running
Cancel()stops the running game (it returns false)
  • difficulty: 'easy', 'medium' or 'hard'. Left out: Config.DefaultDifficulty.
  • options: changes values for this one game only, on top of the difficulty. The names are the same as in Config.Presets, plus key for the main key:
lua
exports['gsd-minigames']:SkillCheck('hard', { rounds = 2, key = 'SPACE' })
exports['gsd-minigames']:Lockpick({ pins = 6, tolerance = 4 })
exports['gsd-minigames']:KeySequence('easy', { pool = { 'W', 'A', 'S', 'D' } })

Call them from a thread

The exports wait for the result, so call them from a thread: inside an event handler, a command or CreateThread.

The result comes from the player's client

For anything valuable, check again on the server (distance, item, cooldown) before you give the reward.

Example: lockpick a door, reward on the server ​

lua
-- client
RegisterNetEvent('my-doors:client:lockpick', function(doorId)
    if exports['gsd-minigames']:Lockpick('medium') then
        TriggerServerEvent('my-doors:server:unlock', doorId)
    end
end)
lua
-- server
RegisterNetEvent('my-doors:server:unlock', function(doorId)
    local src = source
    -- check distance, cooldown and the lockpick item here
    if not GSD.RemoveItem(src, 'lockpick', 1) then return end
    -- unlock the door
end)

Configuration (config.lua) ​

SettingWhat it does
Config.Locale'en', 'hu' or 'de'; the texts are in locales.lua
Config.DefaultDifficultydifficulty used when a script gives none
Config.Keymain key of the skill check, safe and mash: a letter, 'SPACE', 'ENTER' or 'SHIFT' (not A or D, they turn the safe dial)
Config.KeyPoolletters the key sequence picks from
Config.Volumesound volume, 0 - 1 (0 = silent)
Config.TestCommandadmin test command name ('minigames'), false turns it off
Config.Notifylook of the test command's messages: 'bridge', 'gsd', 'framework', 'ox_lib'
Config.Presetsevery value of every game per difficulty (below)

The colors come from GSD Bridge (Config.UiColors), so every GSD window looks the same on your server.

Presets ​

GameValueEasyMediumHardMeaning
skillrounds345hits needed
speed190250320needle speed (degrees / second, +12 % after every hit)
zone705238size of the red zone (degrees)
perfect181410size of the white part (degrees)
keyscount468number of keys
time2.21.61.15seconds for each key
lockpickpins345pins to set
tolerance1285size of the sweet spot (bigger = easier)
health32.21.5seconds the pick lasts while forced at a wrong spot
safenumbers234numbers in the combination
tolerance210how far off still counts (0 = exact)
strikes332wrong tries allowed
steadyneed468seconds inside the zone to fill the bar
zone262014width of the zone (% of the lane)
drift0.711.35speed of the zone
time141618time limit (seconds)
mashgain0.060.0450.035bar filled by one press (0.05 = 5 %)
decay0.120.180.24how fast the bar drains
time876time limit (seconds)

Test command ​

/minigames <game> [difficulty] - for example /minigames safe easy. Only admins can use it (gsd.admin ACE, a VORP admin group or an RSG admin permission - set in GSD Bridge). The result is shown as a notification.

FAQ ​

Nothing happens when I call an export. Check the F8 console: an unknown game name is printed there. An export also returns false right away while another minigame is running or the player is dead.

The window has no style / looks broken. GSD Bridge is missing or starts after gsd-minigames. Put ensure gsd-bridge before it.

Can I change the texts? Yes, in locales.lua. Add a language by copying one block and setting Config.Locale to its name.

Red Dead Redemption 2 belongs to Rockstar Games. Gunsmoke Development is not connected to Rockstar Games.