[QB/ESX] AI NPC Doctor [FREE]

both esx and qb? cause i already tried with removing the QB imports.lua

1 Like

its using the esx ambulance revive, you probably have the configs in esx ambulance set to remove money and items on respawn.

1 Like

removed both imports and now the ems comes out but no revive after paying. also does the same with the esx imports.

2 Likes

Which ambulance job are you using buddy?

Hey mate please use the updated version !

default ambulance job for esx

1 Like

this looks great. thanks for making this free!

1 Like

Im using QB itsnt work properly can u fix it

2 Likes

Progress Bar working on load time

2 Likes

Getting the same - as soon as the player loads, the progressbar appears.

2 Likes

The code has been updated to support most of the old/new QB/ESX !

This is really cool - just having an issue with it automatically triggering when players fly in to the character selection screen. Can’t seem to figure out why it happens, any ideas?

Just realized the two above your last comment are having same issue. So +1 to them lol.

1 Like

ATTENTION!

The script has been updated we have separated the ESX and QB version, even after this if you face issues please let me know.

Same for me also

1 Like
function SpawnVehicle(x, y, z)  
	spam = false
	local vehhash = GetHashKey("ambulance")                                                     
	local loc = GetEntityCoords(PlayerPedId())
	RequestModel(vehhash)
	while not HasModelLoaded(vehhash) do
		Wait(1)
	end
	RequestModel('s_m_m_doctor_01')
	while not HasModelLoaded('s_m_m_doctor_01') do
		Wait(1)
	end
	local spawnRadius = 100                                                    
    local found, spawnPos, spawnHeading = GetClosestVehicleNodeWithHeading(loc.x + math.random(-spawnRadius, spawnRadius), loc.y + math.random(-spawnRadius, spawnRadius), loc.z, 0, 3, 0)

	if not DoesEntityExist(vehhash) then
        mechVeh = CreateVehicle(vehhash, spawnPos, spawnHeading, true, false)                        
        ClearAreaOfVehicles(GetEntityCoords(mechVeh), 5000, false, false, false, false, false);  
        SetVehicleOnGroundProperly(mechVeh)
		SetVehicleNumberPlateText(mechVeh, "HHFW")
		SetEntityAsMissionEntity(mechVeh, true, true)
		SetVehicleEngineOn(mechVeh, true, true, false)
        
        mechPed = CreatePedInsideVehicle(mechVeh, 26, GetHashKey('s_m_m_doctor_01'), -1, true, false)              	
        
        mechBlip = AddBlipForEntity(mechVeh)                                                        	
        SetBlipFlashes(mechBlip, true)  
        SetBlipColour(mechBlip, 5)


		PlaySoundFrontend(-1, "Text_Arrive_Tone", "Phone_SoundSet_Default", 1)
		Wait(2000)
		TaskVehicleDriveToCoord(mechPed, mechVeh, loc.x, loc.y, loc.z, 20.0, 0, GetEntityModel(mechVeh), 524863, 2.0)
		test = mechVeh
		test1 = mechPed
		Active = true

		Citizen.CreateThread(function()
			while true do
			  Citizen.Wait(200)
				if Active or Act then
					local loc = GetEntityCoords(GetPlayerPed(-1))
					local lc = GetEntityCoords(test)
					local ld = GetEntityCoords(test1)
					local dist = Vdist(loc.x, loc.y, loc.z, lc.x, lc.y, lc.z)
					local dist1 = Vdist(loc.x, loc.y, loc.z, ld.x, ld.y, ld.z)
					if dist <= 20 then
						if Active then
							TaskGoToCoordAnyMeans(test1, loc.x, loc.y, loc.z, 1.0, 0, 0, 786603, 0xbf800000)
						end
						if dist1 <= 1 then 
							Active = false
							Act = false
							ClearPedTasksImmediately(test1)
							DoctorNPC()
						end
					end
				end
			end
		end)
    end
end

i tried like this now working well for me!

Not appearing Progress bar when loading time

Citizen.CreateThread(function()
			while true do
			  Citizen.Wait(200)
				if Active or Act then
					local loc = GetEntityCoords(GetPlayerPed(-1))
					local lc = GetEntityCoords(test)
					local ld = GetEntityCoords(test1)
					local dist = Vdist(loc.x, loc.y, loc.z, lc.x, lc.y, lc.z)
					local dist1 = Vdist(loc.x, loc.y, loc.z, ld.x, ld.y, ld.z)
					if dist <= 20 then
						if Active then
							TaskGoToCoordAnyMeans(test1, loc.x, loc.y, loc.z, 1.0, 0, 0, 786603, 0xbf800000)
						end
						if dist1 <= 1 then 
							Active = false
							Act = false
							ClearPedTasksImmediately(test1)
							DoctorNPC()
						end
					end
				end
			end
		end)

Remove these from the client.lua

2 Likes

Please do a PR on GitHub if possible.

very nice updat enow its work for me on esx good job!

1 Like

but i have the problem that when i connect then i get revived after connect and progressbar shown on connect

2 Likes

My only problem for ESX is that after NPC revives me instead of hopping back in Ambulance & driving away & driving away he walks away & ambulance vehicles are left over anyway to fix this?

1 Like

I have made a few changes please check now it should have been fixed!

1 Like