forked from Simnation/Main
99 lines
No EOL
3 KiB
Lua
99 lines
No EOL
3 KiB
Lua
RegisterNetEvent('drteddy:notify')
|
|
AddEventHandler('drteddy:notify', function(titel, text, type)
|
|
Notify(titel, text, type)
|
|
end)
|
|
|
|
function Notify(titel, text, type)
|
|
lib.notify({
|
|
title = titel,
|
|
description = text,
|
|
type = type,
|
|
position = "top",
|
|
iconAnimation = "pulse"
|
|
})
|
|
end
|
|
|
|
function loadModel(model)
|
|
RequestModel(model)
|
|
while not HasModelLoaded(model) do Wait(0) end
|
|
end
|
|
|
|
function spawnDoctor(coords, heading)
|
|
loadModel(Config.DoctorModel)
|
|
local ped = CreatePed(0, Config.DoctorModel, coords.x, coords.y, coords.z, heading or 0.0, true, true)
|
|
SetEntityAsMissionEntity(ped, true, true)
|
|
SetBlockingOfNonTemporaryEvents(ped, true)
|
|
|
|
SetEntityInvincible(ped, true) -- Unsterblich (kein Schaden möglich)
|
|
SetEntityCanBeDamaged(ped, false) -- Kein Schaden erleiden
|
|
SetPlayerCanTargetEntity(ped, false) -- Kann nicht angegriffen werden
|
|
TaskSetBlockingOfNonTemporaryEvents(ped, true) -- NPC reagiert nicht auf Angriffe
|
|
|
|
SetPedFleeAttributes(ped, 0, false) -- Flieht nicht bei Gefahr
|
|
SetPedCombatAttributes(ped, 46, true) -- Keine Kampfreaktionen
|
|
SetPedAlertness(ped, 0) -- Keine Alarmreaktionen
|
|
return ped
|
|
end
|
|
|
|
function reversePath(path)
|
|
local reversed = {}
|
|
for i = #path, 1, -1 do
|
|
table.insert(reversed, path[i])
|
|
end
|
|
return reversed
|
|
end
|
|
|
|
function walkPath(ped, path, onArrival)
|
|
CreateThread(function()
|
|
for i, pos in ipairs(path) do
|
|
TaskGoStraightToCoord(ped, pos.x, pos.y, pos.z, 1.0, -1, pos.w or 0.0, 0.0)
|
|
while #(GetEntityCoords(ped) - vector3(pos.x, pos.y, pos.z)) > 1.0 do
|
|
Wait(300)
|
|
end
|
|
end
|
|
if onArrival then onArrival() end
|
|
end)
|
|
end
|
|
|
|
function DrawText3D(x, y, z, text)
|
|
local onScreen,_x,_y=World3dToScreen2d(x,y,z)
|
|
local px,py,pz=table.unpack(GetGameplayCamCoords())
|
|
SetTextScale(0.35, 0.35)
|
|
SetTextFont(4)
|
|
SetTextProportional(1)
|
|
SetTextColour(255, 255, 255, 215)
|
|
SetTextEntry("STRING")
|
|
SetTextCentre(1)
|
|
AddTextComponentString(text)
|
|
DrawText(_x,_y)
|
|
end
|
|
|
|
function HealPlayerWithARE(ped)
|
|
if not ped then return end
|
|
|
|
-- Beende alle laufenden Aktionen
|
|
ClearPedTasksImmediately(ped)
|
|
|
|
-- Setze Health auf Maximalwert
|
|
local maxHealth = GetEntityMaxHealth(ped)
|
|
SetEntityHealth(ped, maxHealth)
|
|
|
|
-- Stelle sicher, dass der Spieler wiederbelebt ist
|
|
TriggerEvent('visn_are:resetHealthBuffer', ped)
|
|
|
|
-- Entferne Blut, Effekte etc.
|
|
ClearPedBloodDamage(ped)
|
|
ResetPedVisibleDamage(ped)
|
|
ClearTimecycleModifier()
|
|
ClearExtraTimecycleModifier()
|
|
end
|
|
|
|
function IsAnyMedicOnDuty()
|
|
local players = QBCore.Functions.GetQBPlayers()
|
|
for _, player in pairs(players) do
|
|
if player.PlayerData.job.name == 'ambulance' and player.PlayerData.job.onduty then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end |