All resources

rsg-theatre – Developer Docs#

Flow#

  1. Server scheduler (server/server.lua) starts a show every Config.ShowInterval minutes.
  2. Players buy a ticket at the seller NPC (rsg-target → playbill NUI → rsg-theatre:server:buyTicket). Tickets are stored in memory per citizenid and consumed when the holder is within Config.AudienceRadius of Config.Stage at curtain up.
  3. Each viewer gets rsg-theatre:client:playShow(index); all performers, props, rope and audience are local entities.
  4. When a viewer's show ends or they walk away, the client sends rsg-theatre:server:showFinished. The show ends when every viewer has reported or Config.MaxShowLength passes.

Events / callbacks#

NameSideNotes
rsg-theatre:server:getPlaybillserver callbacknext show, minutes, price, hasTicket, running
rsg-theatre:server:buyTicketserver eventvalidates player, cooldown, distance to seller, cash
rsg-theatre:server:showFinishedserver eventonly affects the sender's watching state
rsg-theatre:client:playShowclient eventserver → viewer
rsg-theatre:client:stopShowclient eventserver → viewer when an admin forces a new show

Security#

  • Price, show and distance are all server-side; the client sends no values.
  • Ticket purchases are rate limited (Config.TicketCooldown).
  • /theatre uses RSGCore.Commands.Add with Config.AdminPermission.

Doors#

server/doors.lua inserts four rows into rsg_doorlocks once rsg-doorlock has seeded its table; existing names are skipped.

Dependencies#

rsg-core, rsg-target, oxmysql, rsg-doorlock.

<!-- BEGIN AUTO-REFERENCE (generated from the code; re-run the generator instead of editing by hand) -->

Technical reference#

Generated from the source of rsg-theatre 3.0.2. Names, arguments and defaults below are read straight from the code.

Dependencies#

rsg-core, rsg-target, oxmysql, rsg-doorlock

Configuration#

OptionDefaultNotes
Config.Debugfalse
Config.TicketSellertableTicket seller (placed at the ticket fence volume from theatre_ticket_taker.c)
Config.TicketPrice1.50cash per ticket (server side)
Config.TicketCooldown3seconds between purchases per player
Config.ShowInterval15minutes between shows
Config.FirstShowDelay2minutes after resource start
Config.ShowOrder'rotation''rotation' or 'random'
Config.MaxShowLength420seconds, safety cap on a single show
Config.Stagevector3(2546.41, -1303.55, 46.9)Players must be within this radius of the stage when the show starts
Config.AudienceRadius30.0
Config.Backstagevector3(2553.875, -1313.143, 48.2166)(Local_8.f_42 in show_nbx_bigband_02.c / show_nbx_cancan.c)
Config.Audiencetableseated with the PROP_HUMAN_SEAT_CHAIR scenario; spots 53-55 are standing spots and left out)
Config.AdminCommand'theatre'Admin command to force a show: /theatre <showId>
Config.AdminPermission'admin'
Config.CurtaintableCurtain (generic_show_mc.c / show_nbx_cancan.c func_161/func_163)
Config.CurtainRange60.0curtain is spawned (closed) while you're this close to the stage
Config.CurtainOpenDelay3000ms after the curtain starts opening before the act begins
Config.CurtainCloseDelay4000ms to let the curtain close before the 'show over' message
Config.Showstablerope = optional rope tying a prop to a frozen anchor { prop, anchorModel, anchorCoords, coords, length, ropeTy

Callbacks#

CallbackSideArgumentsFile
rsg-theatre:server:getPlaybillserversrc, cbserver/server.lua
-- client side
RSGCore.Functions.TriggerCallback('rsg-theatre:server:getPlaybill', function(result)
    -- use result
end)

Events#

Server events can be fired by any client, so every handler re-validates the player, the arguments and any permission, distance or cooldown on the server. Never add a reward to a handler without those checks.

EventSideArgumentsFile
rsg-theatre:client:playShowclientindexclient/client.lua
rsg-theatre:client:stopShowclient``client/client.lua
rsg-theatre:server:showFinishedserver``server/server.lua
rsg-theatre:server:buyTicketserver``server/server.lua
-- from a client script
TriggerServerEvent('rsg-theatre:server:showFinished')
-- from a server script
TriggerClientEvent('rsg-theatre:client:playShow', source, index)

Locales#

Language files in locales/: de, el, en, es, fr, ja, nl, pl, pt-br, ro, ru. Set the language with setr rsg:locale "en".

<!-- END AUTO-REFERENCE -->