API Configuraton
Configuration
Below is the configuration required for integrating the API with your FiveM script.
API Key
To use the API, you need an API key. If you are using the one-time payment version, obtain your API key from The Odds API.
API_Config.APIKey = ""
Sports Configuration
Select the sports events you want to track. You can find a list of supported sports and bookmakers on The Odds API website:
API_Config.Sports = {
{
label = "UEFA Euro 2024",
sport = "soccer_uefa_european_championship",
bookmaker = "pinnacle"
},
{
label = "Bundesliga - Germany",
sport = "soccer_germany_bundesliga",
bookmaker = "pinnacle"
},
{
label = "Bundesliga 2 - Germany",
sport = "soccer_germany_bundesliga2",
bookmaker = "pinnacle"
},
{
label = "Baseball - MLB",
sport = "baseball_mlb",
bookmaker = "pinnacle"
}
}
Cache Update Time
The cache update time determines how often the data is refreshed. The Odds API updates every 40 seconds. Setting this value higher will reduce the number of API requests but may result in less current results.
API_Config.CacheUpdateTime = 120
Caching Odds and Scores
The odds and scores are cached in the data/
folder as JSON files. Caching is crucial for the following reasons:
- Performance Improvement: By storing data locally, the script can quickly access the latest odds and scores without making a new API request each time, reducing latency and improving response times.
- Reduced API Requests: Caching helps to minimize the number of API requests, which is especially important for users with limited request quotas. This ensures you stay within your request limits and avoid additional charges.
- Reliability: In case of temporary issues with the API or internet connectivity, the cached data can be used to provide the latest available information, ensuring continuous operation of the script.
Example Configuration
Here is an example of a complete configuration:
API_Config = {}
-- Get your key here: https://the-odds-api.com/
API_Config.APIKey = "your_api_key_here"
API_Config.Sports = {
{
label = "UEFA Euro 2024",
sport = "soccer_uefa_european_championship",
bookmaker = "pinnacle"
},
{
label = "Bundesliga - Germany",
sport = "soccer_germany_bundesliga",
bookmaker = "pinnacle"
},
{
label = "Bundesliga 2 - Germany",
sport = "soccer_germany_bundesliga2",
bookmaker = "pinnacle"
},
{
label = "Baseball - MLB",
sport = "baseball_mlb",
bookmaker = "pinnacle"
}
}
-- Earliest time after the cache is updated in seconds
API_Config.CacheUpdateTime = 120
Possible Issues
If you're experiencing API-ERROR: 0, it's likely due to regional API blocks—countries like Singapore often restrict access. Try changing your server's hosting location or open a Discord ticket to request a refund.
Support
Need help? Our support team is always ready to assist
Join DiscordImage Creator
The image creator script for FiveM allows you to generate transparent images of various game elements with a simple command. This tool is ideal for quickly creating high-quality transparent images of vehicles, weapons, peds, and props.
Team Images
This documentation provides information on configuring team images for our FiveM script, which displays real-time sports odds along with team images. The script pulls images from a GitHub repository.