Installation Advanced Detailed
Installation Advanced Detailed
This guide covers advanced installation steps, database configuration, and optimization settings for the Buy ATM System.
1️⃣ Database Configuration
MySQL Setup
Connection Configuration
Ensure your oxmysql is properly configured. The script uses MySQL queries with prepared statements for security.
oxmysql Configuration:
-- 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
- 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 timestampatm_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:
coordsfield inowned_atmsprevents duplicatesIndexes: 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
Performance Tuning
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_liveto start scanningFly around the map to discover ATMs
Run
/scanatms_liveagain to stopRun
/importatmsto import scanned ATMs
Scan Detection
The scanner detects these ATM models:
Import Process
Bulk Import:
Imports in chunks of 100 ATMs
Prevents database overload
Shows progress in console
Default Settings:
Price: $10,000
Tax: 10%
Location: Auto-categorized by coordinates
Rent: $0 (no rent for unowned ATMs)
5️⃣ Localization Setup
Adding New Languages
Copy Locale File:
Update Locale Code:
Update Config:
Update Loader: Add your language to
locales/loader.luaif 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:
Input Sanitization
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
Audit Logging
All sensitive actions are logged:
Logged Actions:
Ownership changes
Employee additions/removals
Tax rate changes
Revenue withdrawals
Permission modifications
7️⃣ Customization
UI Customization
Modify Styles:
Edit
web/style.cssfor visual changesModify
web/ATM.htmlfor structure changesUpdate
web/script.jsfor 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:
0 = White
1 = Red
2 = Green
3 = Blue
... (see FiveM blip color reference)
8️⃣ Troubleshooting Advanced Issues
Database Connection Issues
Symptoms:
Script fails to start
No ATMs loading
Transaction errors
Solutions:
Verify
oxmysqlis runningCheck database credentials
Verify database exists
Check MySQL server is running
Review
oxmysqllogs
Performance Issues
Symptoms:
Server lag when loading ATMs
High resmon usage
Network overflow errors
Solutions:
Reduce
Config.ProximityRadiusIncrease chunk intervals
Disable
Config.AutoDetectBankDeltaif not neededOptimize database queries (add indexes)
Reduce total ATM count
Coordinate Sync Issues
Symptoms:
ATMs not showing on map
Blips not appearing
"Error fetching coordinates" messages
Solutions:
Wait for chunked sync to complete (1-2 seconds after restart)
Run
/toggleatmblipsto refreshCheck network connectivity
Verify chunked streaming is enabled
Check server console for errors
9️⃣ Backup & Migration
Database Backup
Export Tables:
Migration Between Servers
Export Data:
Import to New Server:
Update Coordinates: If server coordinates differ, update
coordsfield
Version Updates
Before Updating:
Backup database
Backup
config.luaNote any custom modifications
After Updating:
Compare new
config.luawith your backupMerge custom settings
Run any new SQL migrations
Test functionality
🔟 Advanced Features
Custom Transaction Processing
You can manually trigger transaction processing:
Parameters:
atmId: ATM ID numberamount: Transaction amounttransactionType: "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