[ESX] MSK AI Medic

MSK AI Medic

Simple AI Medic NPC that try to revive you

Github Download

Description

  • When you are dead and no Medic is Online then you can press the hotkey
  • An NPC will then come to you with a vehicle and try to revive you
  • You can set a chance whether the NPC manages to revive you or not
  • You can set whether the NPC tries again after a failed attempt or leaves afterwards.
  • Fee for reviving
  • Discord Logs
  • Support for visn_are
  • Support for osp_ambulance

Config

Open Config
Config = {}
----------------------------------------------------------------
Config.Locale = 'de'
Config.VersionChecker = true
----------------------------------------------------------------
-- Add the Webhook Link in server.lua
Config.DiscordLog = true
Config.botColor = "6205745" -- https://www.mathsisfun.com/hexadecimal-decimal-colors.html
Config.botName = "MSK Scripts"
Config.botAvatar = "https://i.imgur.com/PizJGsh.png"
----------------------------------------------------------------
Config.VisnAre = GetResourceState("visn_are") ~= "missing"
Config.OSPAmbulance = GetResourceState("osp_ambulance") ~= "missing"
----------------------------------------------------------------
Config.Hotkey = {label = 'E', key = 38} -- G = 47

Config.AbortMedic = {
    enable = true,
    command = 'abortMedic',
    hotkey = 'X'
}
----------------------------------------------------------------
Config.SpawnRadius = 200.0 -- default: 200.0 meters // Do not set more than 200.0!
Config.DrivingStyle = 786475 -- default: 786475 // https://vespura.com/fivem/drivingstyle/

Config.RevivePrice = 5000 -- Price to get revived
Config.ReviveDuration = 10 -- in seconds // default: 10 seconds

Config.ReviveChance = {
    enable = true, -- Set false that you always get revived
    chance = 50, -- Percent to get revived

    tryagain = false, -- Set to true if the NPC should try it again if he failed
    howOften = 3, -- If NPC failed to revive the player then he tries up to 3 times more
}
----------------------------------------------------------------
-- You will need esx_addonaccount for that!
Config.Society = {
    enable = false, -- Set false if you don't want that the Config.RevivePrice will be added to a society account
    account = 'society_ambulance'
}

Config.Jobs = {
    amount = 0, 
    jobs = {
        'ambulance',
        'fire_department',
    }
}

Config.Medic = {
    name = 'Doc. Holiday', 
    pedmodel = 's_m_m_doctor_01', 
    vehmodel = 'ambulance',
}
----------------------------------------------------------------
Config.ProgressBar = function()
    exports.msk_core:Progressbar(Config.ReviveDuration * 1000, 'Du wirst nun wiederbelebt...')
end

Config.ReviveTrigger = function()
    isDead = false
    medic.called = false
    medic.onRoad = false
    medic.finished = true
    
    if Config.VisnAre then
        TriggerEvent('visn_are:resetHealthBuffer')
    elseif Config.OSPAmbulance then
        TriggerEvent('hospital:client:Revive')
    else
        TriggerEvent('esx_ambulancejob:revive')
    end

    AdvancedNotification(Translation[Config.Locale]['was_revived']:format(Config.Medic.name), 'Los Santos', 'Medical Department', 'CHAR_CALL911')
    TriggerServerEvent('msk_aimedic:removeMoney')
end

Requirements

Optional Requirements

You’ll need one of the Scripts below

My other Scripts

Paid

Free

4 Likes

Update v1.2

  • Fixed OnlineMedics not updating
  • Added Fee for revive
  • Added Discord Webhook
2 Likes

When the medic revives me he doesnt take the money, i do have a fee active, and sometimes the prompt to press E to call him stays on the screen even after he revives you. Otherwise I love the script, been waiting a year for this.

1 Like

I’ll try to fix the bugs

1 Like

Thanks, You’re the best!!

When i use the script the medic drives circles around me and doesn’t revive me

Update v1.3

  • Added Support for visn_are

It works without problems on ESX

im having a problem we i get revived player doesnt get up any help?


Since the visn_are update, I made a few NUI changes by visn_are and integrated them completely. This looks really amazing, nice script!

1 Like

Hey, can you send me the code for that so I can implement this in the Documentation?