wasvendel_minigame
Client-side minigames for RedM. Each export blocks until the player finishes and returns true on success or false on failure. A second minigame cannot start while one is already running; that call returns false immediately.
Installation
- Unzip
wasvendel_minigame. - Drag the
wasvendel_minigamefolder into your server'sresourcesdirectory. - Add the resource to your
server.cfg.
ensure wasvendel_minigameNo framework or database is required.
Configuration
Edit config.lua for on-screen labels, default difficulty, and the chat help text used by the test commands.
client_test.lua registers the test commands. Set Enabled to false in that file to remove them from a live server.
Exports
All exports are client exports. Call them from a thread that can wait, such as inside CreateThread. Counts and timeouts below 1 are ignored and the config default is used.
| Export | Signature | Description |
|---|---|---|
Timing |
(hitCount, timeoutMs) -> boolean |
Moving bar. Press SPACE inside the green zone. |
Circle |
(hitCount, timeoutMs) -> boolean |
Spinning dial. Press the shown key while the needle is in the green arc. |
Strip |
(zoneCount, timeoutMs) -> boolean |
Scrolling zones. Press SPACE as each zone crosses the marker. |
Sequence |
(keyCount, timeoutMs) -> boolean |
Press the shown keys in order. |
Arrows |
(arrowCount, timeoutMs) -> boolean |
Press the shown arrow keys in order. |
Safe |
(pinCount, timeoutMs) -> boolean |
Turn the dial with the arrow keys and lock each pin with SPACE. |
Balance |
(durationMs, reportIntervalMs) -> boolean |
Keep the marker centered with the arrow keys until the duration ends. |
Shrink |
(speed) -> boolean |
Press the shown key while the shrinking shape sits on the green band. |
Random |
() -> boolean |
Runs either Timing or Sequence with config defaults. |
StopBalance |
(success) -> boolean |
Ends an active Balance minigame. Returns false when Balance is not running. |
The first argument may be a table instead of separate values.
| Export | Table fields |
|---|---|
Timing, Circle |
hitCount or count, timeoutMs or timeout |
Strip |
zoneCount or count, timeoutMs or timeout |
Sequence |
keyCount or count, timeoutMs or timeout |
Arrows |
arrowCount or count, timeoutMs or timeout |
Safe |
pinCount or count, timeoutMs or timeout |
Balance |
durationMs, reportIntervalMs, measure |
Shrink |
speed |
Balance also accepts a duration in milliseconds, 0, or the string "measure". Measure mode does not end on its own. It stays up until the marker hits an edge, or until StopBalance is called. StopBalance() and StopBalance(true) count as success. StopBalance(false) counts as failure. In measure mode the reportIntervalMs argument sets how often wasvendel_minigame:balanceTick fires. The default interval is 10 seconds, and values below 1000 are ignored.
Shrink speed is a multiplier. 1 uses the config default. The minigame clamps the value between 0.25 and 5.
Client Example
CreateThread(function()
local success = exports['wasvendel_minigame']:Sequence(4, 12000)
if success then
-- continue the action
end
end)Balance Measure Example
CreateThread(function()
local success = exports['wasvendel_minigame']:Balance('measure', 10000)
end)
-- later, from another thread
exports['wasvendel_minigame']:StopBalance(true)Events
Client Events
| Event | Payload | Description |
|---|---|---|
wasvendel_minigame:balanceTick |
data |
Fired during Balance measure mode. data.elapsedMs is the time reached, and data.tick is the index. |
Test Commands
These commands are registered by client_test.lua while Enabled is true. Optional arguments fall back to config.lua.
| Command | Minigame |
|---|---|
/timing [count] [time_ms] |
Timing |
/crack [count] [time_ms] |
Circle |
/strip [count] [time_ms] |
Strip |
/sequence [count] [time_ms] |
Sequence |
/arrows [count] [time_ms] |
Arrows |
/safe [count] [time_ms] |
Safe |
/balance [time_ms | measure] [report_ms] |
Balance |
/shrink [speed] |
Shrink |
/random |
Random |
/mgtest |
Every minigame in order, using config defaults |