1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-06-30 01:23:02 +02:00
parent 2d5b44dac7
commit cf94f76da1
2 changed files with 38 additions and 23 deletions

View file

@ -114,35 +114,48 @@ Citizen.CreateThread(function()
Citizen.Wait(500)
else
local pos = GetEntityCoords(ped)
local forwardVector = GetEntityForwardVector(ped)
local heading = GetEntityHeading(ped)
local c = Config.Flashlight.color
-- Berechne die Zielposition für das Licht (weiter vorne)
local targetPos = vector3(
pos.x + forwardVector.x * 10.0,
pos.y + forwardVector.y * 10.0,
pos.z + forwardVector.z * 10.0
-- Berechne die Position für den Lichtkegel auf dem Boden vor dem Spieler
-- Konvertiere Heading in Radiant und berechne die Richtung
local headingRad = math.rad(heading)
local forwardX = -math.sin(headingRad)
local forwardY = math.cos(headingRad)
-- Position auf dem Boden vor dem Spieler
local groundPos = vector3(
pos.x + forwardX * 3.0, -- 3 Meter vor dem Spieler
pos.y + forwardY * 3.0,
pos.z - 0.95 -- Auf Bodenhöhe (etwas unter Spielerhöhe)
)
-- Zeichne das Licht mit DrawSpotlightWithShadow für bessere Sichtbarkeit
DrawSpotlightWithShadow(
pos.x, pos.y, pos.z + 1.0, -- Startposition (über dem Kopf)
forwardVector.x, forwardVector.y, forwardVector.z, -- Richtung
c.r, c.g, c.b, -- Farbe
Config.Flashlight.range, -- Reichweite
Config.Flashlight.intensity, -- Helligkeit
Config.Flashlight.range / 2, -- Radius
Config.Flashlight.range * 1.5, -- Falloff
0.0, -- Rundheit
GetHashKey("FLASH_TORCH_LIGHT") -- Shadow ID
-- Zeichne einen nach unten gerichteten Lichtkegel
DrawSpotLightWithRange(
pos.x, pos.y, pos.z + 0.5, -- Lichtquelle etwas über dem Kopf
0.0, 0.0, -1.0, -- Richtung nach unten
c.r, c.g, c.b, -- Farbe
10.0, -- Reichweite
Config.Flashlight.intensity, -- Intensität
1.0, 0.0 -- Innerer und äußerer Kegel
)
-- Zusätzlich einen helleren Punkt am Ziel zeichnen
-- Zeichne einen Lichtkegel in Blickrichtung auf den Boden
DrawSpotLightWithRange(
pos.x, pos.y, pos.z + 0.5, -- Lichtquelle etwas über dem Kopf
forwardX, forwardY, -0.5, -- Richtung nach vorne und leicht nach unten
c.r, c.g, c.b, -- Farbe
Config.Flashlight.range, -- Reichweite
Config.Flashlight.intensity, -- Intensität
0.5, 0.2 -- Innerer und äußerer Kegel
)
-- Zusätzlich einen hellen Fleck auf dem Boden zeichnen
DrawLightWithRange(
targetPos.x, targetPos.y, targetPos.z,
groundPos.x, groundPos.y, groundPos.z + 0.1, -- Leicht über dem Boden
c.r, c.g, c.b,
3.0, -- Radius
Config.Flashlight.intensity / 2 -- Intensität
2.0, -- Radius
Config.Flashlight.intensity / 2 -- Intensität
)
end
@ -153,6 +166,7 @@ Citizen.CreateThread(function()
end
end)
-- Funktion zum Aktivieren der Helm-Lampe
local function ToggleHelmetFlashlight()
local ped = PlayerPedId()

View file

@ -43,11 +43,12 @@ Config.Glasses = {
-- Flashlight configuration
Config.Flashlight = {
color = {r = 255, g = 255, b = 255}, -- Farbe des Lichts (weiß)
range = 50.0, -- Erhöhte Reichweite des Lichts
intensity = 15.0, -- Erhöhte Intensität des Lichts
range = 15.0, -- Reichweite des Lichts (reduziert für realistischeren Effekt)
intensity = 10.0, -- Intensität des Lichts
offset = {x = 0.0, y = 0.3, z = 0.0} -- Position des Lichts relativ zum Kopf
}
-- Helm-Konfiguration für die Lampe
Config.FlashlightHelmet = {
male = {