Installation Advanced Detailed
This guide covers advanced installation steps, database configuration, and optimization settings for the Buy ATM System.
1️⃣ Database Configuration
Connection Configuration
Ensure your oxmysql is properly configured. The script uses MySQL queries with prepared statements for security.
oxmysql Configuration:
Copy -- In your oxmysql configuration
mysql_connection_string = " mysql://user:password@localhost:3306/database_name " Table Structure
The script creates the following tables:
owned_atms - Main ATM data table
Copy - id ( INT , AUTO_INCREMENT, PRIMARY KEY )
- owner ( VARCHAR ( 50 ), NULLABLE) - Player identifier
- location ( VARCHAR ( 100 )) - Location category
- coords ( VARCHAR ( 255 ), UNIQUE ) - Coordinate string
- price ( INT ) - Purchase price
- tax ( DECIMAL ( 10 , 2 )) - Tax percentage
- revenue ( DECIMAL ( 10 , 2 )) - Current revenue balance
- due_rent ( DECIMAL ( 10 , 2 )) - Rent amount
- rent_expires ( DATETIME , NULLABLE) - Rent expiration date
- last_rent_payment ( DATETIME , NULLABLE) - Last payment date
- utilization ( VARCHAR ( 255 )) - Display text
- visitor_count ( INT ) - Visitor tracking
- created_at ( TIMESTAMP ) - Creation timestamp
- updated_at ( TIMESTAMP ) - Last update timestamp atm_transactions - Transaction history
atm_employees - Employee management
atm_admin_logs - Audit trail
Database Indexes
The SQL file automatically creates indexes for optimal performance:
Primary Keys : All tables have auto-incrementing primary keys
Foreign Keys : Proper relationships with CASCADE delete
Unique Constraints : coords field in owned_atms prevents duplicates
Indexes : Employee identifier and ATM ID indexes for fast lookups
Database Maintenance
Auto-Reclaim System
The script automatically reclaims expired ATMs:
Expiry Check : Runs every 10 minutes
Reclaim Threshold : 10 days after rent expiration
Auto-Cleanup : Sets owner to NULL and resets rent fields
Manual Database Queries
Check ATM Ownership:
View Transaction History:
Check Employee Permissions:
2️⃣ Advanced Configuration
Coordinate Streaming Optimization
The script uses chunked streaming to prevent network overflow. You can adjust chunk sizes in server/main.lua:
Recommendations:
Small Servers (< 100 ATMs): Keep default (200)
Medium Servers (100-500 ATMs): Reduce to 150
Large Servers (500+ ATMs): Reduce to 100 or 75
Proximity Detection Tuning
Adjust detection radius based on server performance:
Performance Impact:
Lower values (0.5-1.0): More precise, less CPU usage
Higher values (1.5-2.0): Easier detection, more CPU usage
Auto-Detection Settings
When to Disable:
If you have custom banking scripts that conflict
If you want manual transaction processing only
If experiencing performance issues
Network Optimization
Throttling Configuration
The script includes built-in throttling to prevent spam:
Adjustment:
Increase for slower networks or more players
Decrease for faster networks (not recommended)
Queue System
The coordinate request queue prevents server overload:
Queue Behavior:
Maximum 1 request per player at a time
Automatic processing with delays
Prevents reliable overflow errors
3️⃣ Framework-Specific Setup
QBCore Configuration
Player Data Structure
The script expects standard QBCore player structure:
Bank/Cash Functions
The script uses ic3d_lib abstraction, but QBCore functions are:
ESX Configuration
Player Data Structure
ESX uses different identifier format:
Bank/Cash Functions
ESX uses different money system:
Qbox Configuration
Qbox uses similar structure to QBCore:
4️⃣ ATM Scanning System
Live Scanning Command
The script includes a built-in ATM scanner:
Parameters:
radius (optional): Scan radius in meters (default: 50.0)
interval (optional): Scan interval in milliseconds (default: 200)
Usage:
Run /scanatms_live to start scanning
Fly around the map to discover ATMs
Run /scanatms_live again to stop
Run /importatms to import scanned ATMs
The scanner detects these ATM models:
Bulk Import:
Imports in chunks of 100 ATMs
Prevents database overload
Shows progress in console
Default Settings:
Location: Auto-categorized by coordinates
Rent: $0 (no rent for unowned ATMs)
5️⃣ Localization Setup
Adding New Languages
Update Loader: Add your language to locales/loader.lua if needed
Locale Structure
All UI strings are in the locale file:
NUI Locale Loading
The UI automatically loads locale strings:
6️⃣ Security Configuration
Permission Validation
All server callbacks validate permissions:
The script sanitizes all inputs:
Server ID : Normalized and validated
Tax Rates : Bounded by level limits (0-39%)
Amounts : Positive numbers only
Coordinates : Validated format
All sensitive actions are logged:
Logged Actions:
Employee additions/removals
7️⃣ Customization
UI Customization
Modify Styles:
Edit web/style.css for visual changes
Modify web/ATM.html for structure changes
Update web/script.js for behavior changes
Map Offsets: Adjust map pin positions in web/script.js:
NPC Customization
Change NPC Model:
Change NPC Location:
Blip Customization
ATM Blips:
Blip Colors:
... (see FiveM blip color reference)
8️⃣ Troubleshooting Advanced Issues
Database Connection Issues
Symptoms:
Solutions:
Verify oxmysql is running
Check database credentials
Check MySQL server is running
Symptoms:
Server lag when loading ATMs
Solutions:
Reduce Config.ProximityRadius
Disable Config.AutoDetectBankDelta if not needed
Optimize database queries (add indexes)
Coordinate Sync Issues
Symptoms:
"Error fetching coordinates" messages
Solutions:
Wait for chunked sync to complete (1-2 seconds after restart)
Run /toggleatmblips to refresh
Check network connectivity
Verify chunked streaming is enabled
Check server console for errors
9️⃣ Backup & Migration
Database Backup
Export Tables:
Migration Between Servers
Update Coordinates: If server coordinates differ, update coords field
Version Updates
Before Updating:
Note any custom modifications
After Updating:
Compare new config.lua with your backup
Run any new SQL migrations
🔟 Advanced Features
Custom Transaction Processing
You can manually trigger transaction processing:
Parameters:
amount: Transaction amount
transactionType: "deposit" or "withdraw"
sourceAccount: "bank" or "cash" (optional)
Level System Integration
The level system calculates XP from:
ATM ownership (250 XP per ATM)
Transaction volume (150 XP per $25,000)
Revenue generated (40 XP per $2,000)
Custom Integration:
Employee Permission System
Permission Structure:
Custom Permissions: You can extend the permission system by modifying the UI and server validation.
For more information, see the Configuration Guide and Troubleshooting pages.
Last updated 2 months ago