Minigames
gsd-minigames · Free · Requires GSD Bridge
Six clean, modern minigames for your scripts - one line of code to use.
The games
| Game | Export | How it plays |
|---|---|---|
| Skill check | SkillCheck | A 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 sequence | KeySequence | Press the shown letters in order. Every key has its own short time. |
| Lockpick | Lockpick | Move 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. |
| Safe | SafeCrack | Turn the dial with A / D or the mouse wheel. It clicks on the right number: press the key to lock it in. |
| Hold steady | HoldSteady | Keep the marker inside a wandering zone with A / D until the bar is full. |
| Mash | Mash | Press 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 inconfig.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
Put the
gsd-minigamesfolder into yourresourcesfolder.Add it to your
server.cfgaftergsd-bridge:bashensure gsd-bridge ensure gsd-minigamesRestart the server.
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| Export | Returns |
|---|---|
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 inConfig.Presets, pluskeyfor 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)
| Setting | What it does |
|---|---|
Config.Locale | 'en', 'hu' or 'de'; the texts are in locales.lua |
Config.DefaultDifficulty | difficulty used when a script gives none |
Config.Key | main key of the skill check, safe and mash: a letter, 'SPACE', 'ENTER' or 'SHIFT' (not A or D, they turn the safe dial) |
Config.KeyPool | letters the key sequence picks from |
Config.Volume | sound volume, 0 - 1 (0 = silent) |
Config.TestCommand | admin test command name ('minigames'), false turns it off |
Config.Notify | look of the test command's messages: 'bridge', 'gsd', 'framework', 'ox_lib' |
Config.Presets | every 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
| Game | Value | Easy | Medium | Hard | Meaning |
|---|---|---|---|---|---|
| skill | rounds | 3 | 4 | 5 | hits needed |
speed | 190 | 250 | 320 | needle speed (degrees / second, +12 % after every hit) | |
zone | 70 | 52 | 38 | size of the red zone (degrees) | |
perfect | 18 | 14 | 10 | size of the white part (degrees) | |
| keys | count | 4 | 6 | 8 | number of keys |
time | 2.2 | 1.6 | 1.15 | seconds for each key | |
| lockpick | pins | 3 | 4 | 5 | pins to set |
tolerance | 12 | 8 | 5 | size of the sweet spot (bigger = easier) | |
health | 3 | 2.2 | 1.5 | seconds the pick lasts while forced at a wrong spot | |
| safe | numbers | 2 | 3 | 4 | numbers in the combination |
tolerance | 2 | 1 | 0 | how far off still counts (0 = exact) | |
strikes | 3 | 3 | 2 | wrong tries allowed | |
| steady | need | 4 | 6 | 8 | seconds inside the zone to fill the bar |
zone | 26 | 20 | 14 | width of the zone (% of the lane) | |
drift | 0.7 | 1 | 1.35 | speed of the zone | |
time | 14 | 16 | 18 | time limit (seconds) | |
| mash | gain | 0.06 | 0.045 | 0.035 | bar filled by one press (0.05 = 5 %) |
decay | 0.12 | 0.18 | 0.24 | how fast the bar drains | |
time | 8 | 7 | 6 | time 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.