⚙️API

This page documents the events and callbacks available for developers who want to integrate Var-PaintBall with other resources.


Server Events

These events are triggered from the client to the server.

Queue

-- Join the quick play queue
TriggerServerEvent("var-paintball:server:queue:join")

-- Leave the quick play queue
TriggerServerEvent("var-paintball:server:queue:leave")

Lobby

-- Create a lobby
TriggerServerEvent("var-paintball:server:lobby:create", {
    arena      = "boardwalk",    -- Arena key
    mode       = "TEAM",         -- TEAM | ELIM | FFA | GUNGAME
    weapon     = "paintball",    -- Weapon key
    teamSize   = 3,              -- Players per team
    target     = 35,             -- Target score
    timeLimit  = 600,            -- Max duration (seconds)
    nightMode  = false,
    hardcore   = false,
    friendly   = false,
    autoStart  = true,
    password   = "",             -- Empty = no password
    wager      = 0,              -- 0 = no wager
    wagerAccount = "cash",       -- "cash" or "bank"
})

-- Join a lobby
TriggerServerEvent("var-paintball:server:lobby:join", lobbyId, {
    password      = "",          -- Password if required
    wagerAccount  = "cash",
})

-- Leave a lobby
TriggerServerEvent("var-paintball:server:lobby:leave")

-- Start the match (creator only)
TriggerServerEvent("var-paintball:server:lobby:start")

-- Toggle ready state
TriggerServerEvent("var-paintball:server:lobby:ready")

Match

Other


Client Events

These events are sent from the server to the client.

Interface

Match

Spectator

Leaderboard


Hooks (Framework)

The file server/hooks.lua provides a framework abstraction layer. These functions are used internally but can be modified to fit your server.

circle-info

Hooks auto-detect your framework (ESX, QBCore, Standalone). You normally don't need to modify anything unless you have a very specific setup.


NUI Callbacks

The React interface communicates with the client via these callbacks:

Callback
Description

hideFrame

Close the interface

quickPlay

Join the quick play queue

leaveQueue

Leave the quick play queue

createLobby

Create a lobby

joinLobby

Join a lobby

leaveLobby

Leave a lobby

startLobby

Start the match

toggleReady

Toggle ready state

setNickname

Set a nickname

leaveMatch

Leave the match

spectateMatch

Spectate a match

stopSpectating

Stop spectating

refreshLeaderboard

Refresh the leaderboard


Database Schema

最后更新于