Kodara Studio

Kodara Studio / AutoEscola

AutoEscola documentation

Back to the script page

Requirements

  • OneSync turned on (the txAdmin default). If it is off, the console warns at startup.
  • oxmysql, also on standalone (licenses and settings live in the database).
  • One of: Qbox, QBCore, ESX Legacy (tested on 1.16), or none (standalone). The framework is detected automatically.
  • A FiveM server with a recent artifact.

Installation

  1. Put the autoescola folder in resources.
  2. In server.cfg, after your framework and oxmysql, add:
ensure autoescola
add_ace group.admin autoescola.admin allow
# optional: Discord log (stays on the server, never sent to players)
set autoescola_webhook "https://discord.com/api/webhooks/..."
  1. Restart the server. Tables are created automatically (autoescola.sql is only for databases where you have no CREATE permission).
  2. The console prints framework detectado: ... and pronto.
  3. If a license has no route, no vehicle, no questions or an invalid price, the console prints a red INDISPONÍVEL line saying what is missing. That license shows as unavailable in the menu, so nobody pays for it.
  4. In game, open /drivingschool (or /autoescola). The home tab shows what is still missing.

Who is admin: anyone with the ACE permission autoescola.admin, on any framework. On ESX and QBCore the groups admin, god and superadmin also work (Config.AdminGroups). On Qbox and standalone it is ACE only (add_principal identifier.fivem:YOUR_ID group.admin).

Wrong order in server.cfg: if the resource starts before your framework it waits for it. After 15 s it prints a red ESPERANDO O FRAMEWORK warning. Move ensure autoescola below the framework, or set Config.Framework = 'standalone' in config.lua if you use none.

Updating

  1. Keep a copy of your current autoescola folder (your edits are in config.lua, config_server.lua, locales.lua, locales/, server/questions.lua, bridge.lua and html/config.css).
  2. Replace the whole folder with the new one. Do not mix files from different versions.
  3. Redo your edits in the new files.
  4. Restart the whole server, or type refresh and then restart autoescola in the console. restart alone keeps the old file list; if the new version added a file you get attempt to call a nil value.

If you edited the UI (html/ folder), replace the whole html/ folder too and redo your edits there. Everything saved from the panel and all player licenses live in the database and are kept.

Configuration files

FileWho reads itWhat it holds
config.luathe server and every player's gameLanguage, framework, commands, reception (NPC and icon), key or ox_target/qb-target, speed unit, instructor (and voice), result sound
config_server.luathe server onlyMoney, admin permission, exam rules and limits, anti-teleport, driving lock, exports and the 7 licenses (prices, vehicles and routes)

Everything in config.lua is downloaded by players, so rules live in config_server.lua. Do not put anything sensitive in config.lua. The Discord webhook is in neither: it is a server.cfg convar.

Almost everything can also be changed from the in-game panel, with no file editing and no restart.

What you save in the panel overrides the config files (language, speed unit, prices, routes, vehicles, colours...). The console lists them at startup.

First setup

Everything from the panel (/drivingschool).

  1. Reception (exam NPC): it starts at Legion Square. To move it, go to Ajustes (Settings) and use the reception form, or stand where you want it and click Usar minha posição, then save. It changes for everyone at once.
  2. Language: Ajustes → Idioma → English (also Español, Deutsch, Français, Italiano, Türkçe, Português). The panel switches right away.
  3. Prices, waiting time and mistakes: Provas → pick the license. The number of mistakes that fails the exam is set there: with 5, the 5th mistake fails.
  4. Exam vehicle: on the same screen, type the spawn name and change it. The game checks that the model exists (add-on too) and is the right type.
  5. Route: Gravar percurso (Record route) takes you to the start point inside the vehicle. Drive, mark stops where needed, and return to the start: the route closes itself. Cancelling does not lose the previous route. Restaurar padrão restores the factory route.

For aircraft, record while flying: height counts. Seven ready-made routes are included for the default GTA map.

How the exam works

  • Enrollment (paid once) → theory → practical. Failed? Retake only the step that failed, with a configurable fee and waiting time.
  • Prerequisites: truck and bus require car; trailer requires truck.
  • The server decides everything. Checkpoints, stops, speed, crashes, trailer, time and result are measured on the server. Theory answers never reach the player.
  • Leaving the route: the server compares the vehicle with the recorded trail (35 m tolerance, Config.PathTolerance). About 4 s without getting closer triggers a warning, and the student has 8 s (Config.OffRouteSeconds) to get back on the trail, otherwise the exam fails.
  • Teleporting: a vehicle that "jumps" fails the exam with the reason "impossible movement", leaves a practical_suspect log and alerts online admins. Real lag does not fail it. Settings in Config.AntiTeleport.
  • Private dimension: always on. Private exam dimensions use routing buckets 7301–7556 by default (Config.PrivateExam.bucketBase).
  • Cancelled exam (server fault): if the exam vehicle disappears before use, the exam is cancelled, the fee is refunded and no attempt is counted.
  • Reaching a license: on pass the license is issued and mirrored to the framework (metadata.licences on Qbox/QBCore, esx_license on ESX).
  • Vehicle keys are delivered automatically for qbx_vehiclekeys, qb-vehiclekeys, wasabi_carlock, Renewed-Vehiclekeys and cd_garage. Other systems: write a function in Config.VehicleKeys.

Driving lock

All in Config.Enforcement (config_server.lua) and in the panel (Veículos and Ajustes).

  • Block on (default): no license, no driving. The engine is cut and the player leaves the seat.
  • Bypass check: if a blocked person stays in the seat with the engine on and the vehicle moves more than 40 m, admins are alerted, it is logged and the autoescola:possibleBypass event fires. It is a suspicion for an admin to review, not proof.
  • block.onBypass = 'delete' (off by default) also deletes the vehicle. It deletes even another player's vehicle or a police car.
  • Block off: the person drives, gets a fine and the police get a map alert.
  • Emergency vehicles: police, ambulance and fire vehicles only for on-duty staff of that service. Job-owned vehicles can be set per vehicle in Veículos.
  • Add-on vehicles: register them in Veículos as License required, Job vehicle or Free.
  • Standalone: there are no jobs, so emergency vehicles are free (emergency.standaloneFree = true).
  • Bicycles are free. Exceptions: exemptModels, exemptJobs, exemptAdmins.

Commands

CommandWhoWhat it does
/drivingschooladminOpens the panel. Also /autoescola, /autoescuela, /fahrschule, /autoecole, /autoscuola, /surucukursu
/ae escola (school)adminSets the reception where you stand
/ae spawn <cat>adminSets the license start point
/ae ir <cat> (goto) · /ae ir x y [z]adminGo to the start point or to a coordinate
/ae gravar <cat> (record)adminRecords the route
/ae parada (stoppoint) · /ae parar (stop)adminMarks a mandatory stop · ends recording
/ae ver <cat> (show)adminShows the route for 60 s
/ae rota <cat> (route)adminManual route editing
/giveupplayerGives up the practical exam (counts as a fail). Also /desistir, /abandonar, /abbrechen, /abandonner, /abbandona, /vazgec
aefechar (F8)playerCloses any driving school screen and gives the mouse back

Every name works in every language. To change them or keep just one, edit Config.Commands in config.lua. Categories: carro/car, moto, caminhao/truck, onibus/bus, carreta/trailer, aeronave/air, barco/boat.

Exports and events

On the server:

exports.autoescola:HasLicense(source_or_identifier, 'car')   -- true/false
exports.autoescola:GetAllLicenses(source_or_identifier)      -- { 'car', 'moto' }
exports.autoescola:IsInExam(source)
exports.autoescola:CanDrive(source, netId)                    -- same answer as the driving lock
exports.autoescola:GiveLicense(source_or_identifier, 'boat', 'issued_by')   -- write
exports.autoescola:RemoveLicense(source_or_identifier, 'car', 'reason')     -- write
exports.autoescola:ExemptVehicle(netId, true)                                -- write

Reading is open. Writing is off by default: set Config.Exports.allowWrite = true and add your resource name to Config.Exports.whitelist (an empty list denies all). Every write is logged with the resource name.

On the client, exports.autoescola:HasLicense('car') is only for UI decoration. Use the server export to decide anything.

Server events: listen with AddEventHandler only, never RegisterNetEvent.

AddEventHandler('autoescola:driverWithoutLicense', function(src, category, coords, fine)
    -- someone driving without a license (hook into your dispatch)
end)

AddEventHandler('autoescola:possibleBypass', function(src, vehicle, plate)
    -- SUSPICION of a bypassed lock. Alert staff; do not auto-ban.
end)

Reception, sound and instructor voice

By default the player walks up to the NPC and presses E. To use your server's look-and-click, set in config.lua:

Config.Interact = { ..., target = 'auto' }   -- 'none' (E key) | 'auto' | 'ox_target' | 'qb-target'

Result sound: a GTA sound plays when an exam ends (pass or fail). Change or turn it off in Config.Sounds (enabled = false).

Instructor voice: the NPC instructor reacts with GTA's own voice lines. Only the student hears them. Change or mute it in Config.Instructor.voice (voice = false).

Screen colours

From the panel: /drivingschool → Aparência tab. Pick a ready-made theme or any #rrggbb colour, then Salvar para todos to apply for everyone. Only admins can save.

From the file: factory colours are in html/config.css, written as R, G, B (e.g. --ae-accent: 30, 110, 230;). Save, run restart autoescola and reopen the screen. A colour saved from the panel overrides the file.

Languages and texts

locales.lua holds Portuguese, English and Spanish, and locales/ holds German, French, Italian and Turkish. server/questions.lua holds the theory questions in all 7 languages. All of it is open for editing.

To add a language, copy locales/de.lua, rename it (e.g. locales/pl.lua and Locales.pl), translate it and add questions in server/questions.lua (Questions.pl). The new language appears in Ajustes → Idioma on its own. Missing text falls back to Portuguese.

The factory theory questions are the same for every buyer, so replace some and add your own.

Database

Tables are created automatically (utf8mb4): autoescola_licenses, autoescola_progress, autoescola_attempts, autoescola_logs, autoescola_names, autoescola_settings, autoescola_mirror.

If Incorrect string value shows up in the console, convert once: ALTER TABLE autoescola_logs CONVERT TO CHARACTER SET utf8mb4; (repeat for the other 6).

Automatic cleanup: the action log is deleted after 90 days and the exam history after 365 days (Config.Retention; 0 = never). Licenses, enrollments and settings are never deleted.

Troubleshooting

  • ESPERANDO O FRAMEWORK: ensure autoescola must come after the framework. With no framework, set Config.Framework = 'standalone'.
  • ainda NÃO está pronta: the resource could not reach the database. Check the oxmysql errors above it and your mysql_connection_string.
  • "Exam cancelled" or the exam vehicle disappears on spawn: a blacklist or anticheat script is deleting the model. Change the model in the panel or allow it in that list.
  • Strange text such as step_of after updating: files from different versions were mixed. Redo the update completely.
  • attempt to call a nil value after updating: the resource was restarted with restart only. Type refresh and then restart autoescola, or restart the server.
  • Panel does not open: check the add_ace group.admin autoescola.admin allow line and that your account is in group.admin.
  • carteira X INDISPONÍVEL: the line says what is missing (route, vehicle, questions, price). Fix it in the panel or in config_server.lua and restart the resource.
  • Reception NPC does not show: if the Config.School.ped model does not exist, F8 warns and the reception works with the yellow marker.
  • Mouse stuck after a screen error: type aefechar in F8.
  • Factory routes were recorded on the default GTA map. With a map that changes those streets, record again from the panel.
  • Honest student failed for "impossible movement": only with very long game freezes. Loosen Config.AntiTeleport (lagSeconds, margin) or turn it off (enabled = false). Do not lower maxKmh.
  • Diagnostics: Config.Debug = true prints DIAG messages. Keep it false in production.