local QBCore = exports['qb-core']:GetCoreObject() local doorbellCooldowns = {} -- Benachrichtigung empfangen RegisterNetEvent('qb-doorbell:client:receiveNotification', function(message, senderName) lib.notify({ title = 'Klingel', description = message .. '\nVon: ' .. senderName, type = 'inform', duration = 8000, position = 'top' }) end) -- Klingel-Funktion local function RingDoorbell(doorbellData) local currentTime = GetGameTimer() -- Cooldown Check if doorbellCooldowns[doorbellData.id] and (currentTime - doorbellCooldowns[doorbellData.id]) < Config.CooldownTime then local remainingTime = math.ceil((Config.CooldownTime - (currentTime - doorbellCooldowns[doorbellData.id])) / 1000) lib.notify({ title = 'Klingel', description = 'Du musst noch ' .. remainingTime .. ' Sekunden warten!', type = 'error', duration = 3000 }) return end -- Cooldown setzen doorbellCooldowns[doorbellData.id] = currentTime -- Server Event triggern TriggerServerEvent('qb-doorbell:server:ringDoorbell', doorbellData) lib.notify({ title = 'Klingel', description = 'Du hast geklingelt!', type = 'success', duration = 3000 }) end -- Klingel-Interaktionen erstellen local function CreateDoorbellInteractions() for _, doorbell in pairs(Config.Doorbells) do local point = lib.points.new({ coords = doorbell.bellCoords, distance = Config.InteractionDistance, doorbell = doorbell }) function point:onEnter() lib.showTextUI('[E] ' .. self.doorbell.label, { position = "left-center", icon = 'bell' }) end function point:onExit() lib.hideTextUI() end function point:nearby() if IsControlJustPressed(0, 38) then -- E Key RingDoorbell(self.doorbell) end end end end -- Initialisierung CreateThread(function() Wait(1000) CreateDoorbellInteractions() end)