πΌοΈ[FREE] Adaptive Cards Boilerplate
A lightweight Lua boilerplate for integrating Adaptive Cards into your FiveM connection process using deferrals. Built by the PyroByte team.
π¦ Overview
This boilerplate demonstrates how to display interactive Adaptive Cards to players when they connect to your FiveM server. It's designed to improve the user experience during the connection phase.
Cards can range from basic buttons to styled forms and complex layouts.
β¨ Features
π¦ Simple Cards β Title, message & single action
π Form Cards β Input fields with multiple actions
π Card Switching β Easily change views in real-time
β³ Timeout Handling β Auto-failure or countdown after inactivity
π¨ Styled Cards β Use consistent styles via
Config.Styles
π File Structure
pyro-adaptivecards-boilerplate/
βββ fxmanifest.lua
βββ sv_main.lua # Sample connection handler with card flow
βββ functions.lua # Card creation helpers
π§ͺ Examples Included
Each scenario is covered in the sample server script:
β Main Menu Card
π Recovery Form
βοΈ Success Message
β±οΈ Timeout Countdown
π Welcome Card with rules
π¨ Styled Card using Config.Styles
π Card Creation Functions
CreateSimpleCard(title, message, buttonText, buttonId)
CreateSimpleCard(title, message, buttonText, buttonId)
Creates a basic card with a heading, message, and one button.
CreateMultiActionCard(title, message, actions)
CreateMultiActionCard(title, message, actions)
Accepts a list of buttons with labels and styles. Good for menus.
actions = {
{ title = "Login", id = "submit_login", style = "positive", color = "light" },
{ title = "Cancel", id = "submit_cancel", style = "default", color = "light" }
}
CreateFormCard(title, message, inputFields, submitText, submitId, backText?, backId?)
CreateFormCard(title, message, inputFields, submitText, submitId, backText?, backId?)
Builds a card with text input fields.
inputFields = {
{ id = "email", placeholder = "Enter your email", style = "email" }
}
CreateComplexCard(title, message, backgroundImage)
CreateComplexCard(title, message, backgroundImage)
A styled layout with optional top-right nav (Back/Exit), centered message, and multiple buttons.
CreateStyledCard(title, message, styleName, buttonText, buttonId, backgroundImage?)
CreateStyledCard(title, message, styleName, buttonText, buttonId, backgroundImage?)
Uses styles from your Config.Styles
object for consistent theming.
π Deferral Flow
Outlined in sv_main.lua
:
Player connects
Main menu displayed
Form submitted or canceled
Timeout or success triggers
Deferral ends with
done()
or rejection
βοΈ Installation
Clone or download the repository
Place it in your server's
resources
folderAdd this to your
server.cfg
:ensure pyro-adaptivecards-boilerplate
π¨ Customization Tips
Replace image URLs with your own CDN or Imgur links
Add or modify styles in
Config.Styles
Update logic in
sv_main.lua
to match your server's workflow
π Requirements
A FiveM server
Basic Lua knowledge
π₯ Link
π Support
Need help or have questions? β Join the PyroByte Discord
Last updated