82 lines
2.2 KiB
Lua
82 lines
2.2 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)
|
||
|
--stretcher = AttachStretcherToTeddy(ped)
|
||
|
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
|