ESX

AI Paramedic Documentation for ESX

Introduction

AI Paramedic is an advanced automatic medical rescue system for FiveM servers with ESX framework. The script introduces intelligent AI paramedics who respond to calls from players in critical condition, adapting the rescue vehicle type to the player's location.

Key Features

  • 3 rescue types: ambulance, helicopter, boat

  • Intelligent vehicle selection based on location

  • 2 rescue modes: normal (on-site resuscitation) and advanced (hospital transport)

  • Bucket system for player isolation during transport

  • Realistic surgery simulation with NUI interface

  • ETA system with arrival time calculation

  • 11 languages: English, German, Spanish, French, Dutch, Polish, Portuguese, Thai, Turkish, Arabic, Chinese

System Requirements

Required

  • FiveM Server (latest version)

  • ESX Framework (Legacy or newer)

  • es_extended (imported in manifest)

  • esx_progressbar (for progress bars)

Optional Resources

Included in package:

  • polmav - helicopter model

  • emsprops - medical props (stretcher, AED)

  • strykergurney - stretcher model

  • loweredstrykergurney - lowered stretcher model

Technical Requirements

  • Server RAM: minimum 2GB free memory

  • Processor: 2+ cores

  • OneSync: recommended for bucket stability

Installation

Step 1: Prepare Files

Extract archive to resources folder:

File structure should look like:

Step 2: Install Dependencies

In server.cfg add in order:

Step 3: Database Configuration

βœ… Note: Script DOES NOT REQUIRE database changes - works without additional tables.

Step 4: Verify Installation

Test command in F8 console:

If message appears, installation is successful.

Configuration

Basic Settings

Framework and Localization

NUI Language Setting

To change the surgery interface (NUI) language, edit file nui/script.js:

ℹ️ Available language codes: en, de, es, fr, nl, pl, pt, th, tr, ar, cn

Medic Limits

Special Rescue

Job Whitelist

Rescue Modes

Normal Mode

  • Medic resuscitates on site

  • Uses AED defibrillator

  • Resuscitation time: 10 seconds

Advanced Mode

  • Medic examines player (10 seconds)

  • If injuries severe β†’ transport to hospital

  • If injuries minor β†’ resuscitation on site

Payment System

Vehicle Configuration

Ambulance

Helicopter

Boat

Hospital Locations

Rescue Systems

Decision System

Script automatically selects rescue vehicle type:

Player Location
Vehicle Type

In water

Rescue boat

Remote area

Helicopter

Road/city

Ambulance

Rescue Flow

  1. Player dies β†’ System checks location

  2. Vehicle selection β†’ Ambulance/Helicopter/Boat

  3. Rescue mode:

    • Normal β†’ On-site resuscitation

    • Advanced β†’ Examination β†’ Transport (if needed)

  4. Completion β†’ Player revival

Death Causes Requiring Transport

File death_causes.lua defines categories:

ETA System

Factors affecting estimated arrival time:

  • Straight-line distance

  • Terrain type (city/highway/mountains)

  • Traffic density

  • AI driving style

  • Terrain height

  • Time of day (rush hours)

Real speeds:

  • City (traffic): 8.0 m/s

  • Suburban: 22.0 m/s

  • Highway: 30.0 m/s

  • Mountains: 15.0 m/s

Technical Architecture

Bucket System

Bucket flow:

  1. Player default in bucket 0

  2. During transport β†’ bucket 10000-20000 (random)

  3. AI vehicles moved to same bucket

  4. After completion β†’ return to bucket 0

Monitoring System

Element
Frequency

Player state

every 1 second

Vehicle position

every 250ms

Distance to target

every 500ms

Bucket state

every 5 seconds

ETA timeout

dynamically

API and Events

Client Events

ESX Callbacks

Admin Commands

Command
Description
Access

restore_buckets

Restores all buckets

Server console

Troubleshooting

Problem: Ambulance doesn't arrive

Diagnostics:

Solutions:

  • Reduce SpawnRadius (try 200-250)

  • Check map collisions nearby

  • Verify vehicle model exists

  • Ensure ESX is working properly

Problem: Surgery doesn't start

Check:

  • NUI files in nui/media/ (mp4, mp3)

  • File read permissions

  • Browser console errors (F12)

Problem: Buckets don't reset

Performance Optimization

Performance Settings

Best Practices

Production Configuration

Adding Translations

The locales/ folder contains 11 ready translations. To add your own language:

  1. Copy file locales/en.lua

  2. Rename e.g. to locales/custom.lua

  3. Translate all keys

  4. In config.lua set: Ylean.Locales = "custom"

  5. In nui/script.js set: let currentLanguage = 'custom';

Technical Support

Type
Information

Discord

Version

1.0.1

Debug

Ylean.Debug = true

License

⚠️ Prohibited:

  • Code distribution

  • Resale

  • Modification of encrypted parts

βœ… Allowed:

  • Configuration file modification

  • Location customization

  • Integration with own systems


This documentation covers all aspects of the AI Paramedic script. For questions, contact technical support.

Last updated