local QBCore = exports['qb-core']:GetCoreObject() print("^2[TRAIN-TRIGGER]^7 Client Script wird geladen...") -- Test ob QBCore funktioniert CreateThread(function() Wait(2000) if QBCore then print("^2[TRAIN-TRIGGER]^7 QBCore erfolgreich geladen auf Client") else print("^1[TRAIN-TRIGGER]^7 FEHLER: QBCore nicht gefunden auf Client!") end end) -- Einfache Locations (gleiche wie Server) local trainLocations = { {x = 215.3, y = -810.1, z = 30.7, name = "Legion Square"}, {x = -265.0, y = -957.3, z = 31.2, name = "Pillbox Hospital"}, } local showMarkers = false -- Test Command RegisterCommand('togglemarkers', function() showMarkers = not showMarkers print("^3[TRAIN-TRIGGER]^7 Markers: " .. tostring(showMarkers)) if QBCore and QBCore.Functions and QBCore.Functions.Notify then QBCore.Functions.Notify('Markers: ' .. tostring(showMarkers), 'primary') else TriggerEvent('chatMessage', "SYSTEM", "normal", "Markers: " .. tostring(showMarkers)) end end, false) -- Marker Loop CreateThread(function() while true do local sleep = 1000 if showMarkers then local playerCoords = GetEntityCoords(PlayerPedId()) for i, location in ipairs(trainLocations) do local distance = #(playerCoords - vector3(location.x, location.y, location.z)) if distance < 200.0 then sleep = 0 -- Grüner Marker DrawMarker(1, location.x, location.y, location.z - 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 3.0, 2.0, 0, 255, 0, 150, false, true, 2, nil, nil, false) if distance < 20.0 then -- 3D Text local onScreen, _x, _y = World3dToScreen2d(location.x, location.y, location.z + 2.0) if onScreen then SetTextScale(0.4, 0.4) SetTextFont(4) SetTextProportional(1) SetTextColour(255, 255, 255, 215) SetTextEntry("STRING") SetTextCentre(1) AddTextComponentString("[E] " .. location.name .. "\nDistanz: " .. math.floor(distance) .. "m") DrawText(_x, _y) end if IsControlJustPressed(0, 38) then -- E print("^3[TRAIN-TRIGGER]^7 E gedrückt bei " .. location.name) TriggerServerEvent('train:requestStart') end end end end end Wait(sleep) end end) print("^2[TRAIN-TRIGGER]^7 Client Script geladen! Commands: /togglemarkers")