Untitled
unknown
plain_text
2 years ago
2.1 kB
7
Indexable
-- Funktion zum Hinzufügen eines NPCs
function AddNPC(x, y, z, heading, hash, model, headingText, animation)
RequestModel(hash)
while not HasModelLoaded(hash) do
Wait(15)
end
RequestAnimDict(animation)
while not HasAnimDictLoaded(animation) do
Wait(15)
end
local ped = CreatePed(4, hash, x, y, z - 1, heading, false, true)
SetEntityHeading(ped, heading)
FreezeEntityPosition(ped, true)
SetEntityInvincible(ped, true)
SetBlockingOfNonTemporaryEvents(ped, true)
TaskPlayAnim(ped, animation, "base", 8.0, 0.0, -1, 1, 0, 0, 0, 0)
end
-- Funktion zum Zeichnen von Text in 3D
function DrawText3D(x, y, z, text, scl, font)
local onScreen, _x, _y = World3dToScreen2d(x, y, z)
if onScreen then
local camX, camY, camZ = table.unpack(GetGameplayCamCoords())
local dist = GetDistanceBetweenCoords(camX, camY, camZ, x, y, z, 1)
local scale = (1 / dist) * scl * (1 / GetGameplayCamFov()) * 100
SetTextScale(0.0, 1.1 * scale)
SetTextFont(font)
SetTextProportional(1)
SetTextColour(255, 255, 255, 255)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextEdge(2, 0, 0, 0, 150)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
DrawText(_x, _y)
end
end
-- Thread zum Hinzufügen von NPCs
CreateThread(function()
for _, v in pairs(Config.Peds) do
AddNPC(v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8])
end
end)
-- Thread zum Anzeigen von Text
CreateThread(function()
while Config.displayText do
local pos = GetEntityCoords(PlayerPedId())
Wait(0)
for _, v in pairs(Config.Peds) do
local distance = #(pos - vec3(v[1], v[2], v[3]))
if distance < Config.displayDistance then
DrawText3D(v[1], v[2], v[3] + 1, Config.displayColor .. v[7], 1.2, 1)
end
end
end
end)
Editor is loading...
Leave a Comment