Commands#
Gym Creator registers two in-game commands. Everything else — prices, decay, positions — is changed in the creator, not with commands.
Command | Key | Who | Description |
|---|---|---|---|
| — | Admins and | Opens the creator. Anybody else sees "You do not have permission to use this." The name is |
|
| Everyone | Shows or hides the strength and stamina HUD. The default key is |
During a workout, SPACE performs a rep and DELETE stops the set. In placement mode, left click places, the mouse wheel turns, the arrow keys change the height and BACKSPACE cancels.
Reading Stats from Your Own Scripts#
Gym Creator does not need exports to share what it knows: the stats live in GTA's native stats and in one database table, and every change is announced with an event.
Client: a player's strength and stamina
With Config.AffectPedStats = true (the default), both stats are written into GTA's own stats, which any client script can read:
local _, strength = StatGetInt(`MP0_STRENGTH`, -1)
local _, stamina = StatGetInt(`MP0_STAMINA`, -1)
if strength >= 60 then
-- a heavy-lifting job, a bouncer role, a fight club entry...
endTo ask the server directly, without depending on the native stats:
local stats = lib.callback.await('gym:getStats', false)
print(stats.strength, stats.stamina) -- 0 to 100Client: react when the stats change
The server sends gym:syncStats to a player every time their stats change — after a finished set and after the nightly decay. Any client resource can listen to it:
RegisterNetEvent('gym:syncStats', function(stats)
-- stats = { strength = 42, stamina = 17 }
SendNUIMessage({ action = 'fitness', data = stats }) -- e.g. a phone app
end)Client: does this player have a membership?
local m = lib.callback.await('gym:checkMembership', false, gymId)
-- m.active : true when they may train at gymId
-- m.expiry : unix time the membership ends (0 if none)
-- m.gymId : the gym the membership belongs to
-- m.free : true when that gym needs no membershipLeave gymId out to get the player's membership whatever gym it belongs to.
Server: stats of any player, online or offline
Everything is in qs_gym_player_data, keyed by the framework's character id — the ESX identifier, or the QBCore / Qbox citizenid:
local row = MySQL.single.await(
'SELECT strength, stamina, membership_gym_id, membership_expiry FROM qs_gym_player_data WHERE identifier = ?',
{ citizenid }
)Read it rather than writing to it: an online player's stats are cached by Gym Creator, so a value written from outside is overwritten by their next workout.
Server: send a gym-styled notification
The script's toasts can be used from any server resource:
TriggerClientEvent('gym:notification', source, 'Your trainer is waiting at the gym.', 'info')
-- type: 'info' · 'success' · 'error'Events#
Event | Side | When it fires |
|---|---|---|
| Client | A player's stats changed. Carries |
| Client | A toast is shown. Carries the message and its type. |
| Client | A gym was created, saved or deleted in the creator. Carries the gym, or its id. |
| Client | The full list of gyms, sent when a player joins and when the resource starts. |
These events are sent by Gym Creator. Listen to them; do not trigger the server-side ones yourself. Completing a workout, buying a membership and changing a gym are validated on the server — membership, station, exercise, permissions and timing — and a forged call is ignored.
Callbacks#
Available through ox_lib from any client resource, with lib.callback.await(name, false, ...):
Callback | Returns |
|---|---|
|
|
|
|
|
|



