Events
⚡ Events
🖥️ Server Events
These events are registered on the server-side (server/main.lua) and are triggered by the client.
competition:server:fetchInitialData
Triggered when the NUI is opened to fetch all relevant data for the player, including their roosters and the server ranking.
competition:server:registerRoosterWithItem
Called when a player registers a new rooster. Consumes an unregistered rooster item and creates a new entry in the database.
competition:server:renameRooster
Updates the name of one of the player's roosters.
competition:server:upgradeStat
Called when a player uses an upgrade point to increase a rooster's stat (HP, Attack, Defense).
competition:server:startSoloFight
Initiates a PvE training fight against a selected NPC opponent.
competition:server:getNearbyPlayers
Fetches a list of nearby players who can be challenged to a PvP fight.
competition:server:sendChallenge
Sends a fight challenge to a target player.
competition:server:respondToChallenge
Handles the target player's response (accept or refuse) to a challenge.
competition:server:startPvpFightWithSelection
Called after a challenged player accepts and selects their rooster, officially starting the PvP fight process.
📡 Client Events
These events are registered on the client-side (client/main.lua) and are triggered by the server.
competition:client:receiveInitialData
Receives the initial data from the server (rooster list, ranking, etc.) and populates the NUI.
competition:client:refreshNui
Forces a refresh of the NUI data, typically after an action like registering or renaming a rooster.
competition:client:notify
Displays a basic notification to the player using ox_lib.
competition:client:showPlayerList
Opens the player selection modal in the NUI with a list of nearby players to challenge.
competition:client:receiveChallenge
Receives a challenge from another player and shows a confirmation dialog.
competition:client:promptPvpRoosterSelection
Prompts the challenged player to select one of their available roosters for the fight.
competition:client:startPvpShow / startSoloShow
Initiates the in-game visual sequence for the fight, moving the player and spawning the rooster peds.
competition:client:updateFightUI
Updates the health bars and HP text on the fight HUD during a battle.
competition:client:playHitEffect
Triggers particle and visual effects on the rooster peds when a hit is simulated.
competition:client:showResult
Displays the final result screen (win/loss) after a fight concludes and handles cleanup of peds and arena.
competition:client:forceNuiClose
Forces the NUI to close, typically right before a fight begins.
Last updated
