> For the complete documentation index, see [llms.txt](https://docs.fivem.id/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fivem.id/fmid_loop/contoh-penggunaan-1.md).

# Contoh Penggunaan 1

contoh basic, fmid\_loop + ox\_lib

```lua
local aktif = false

-- Contoh Loop Default
CreateThread(function()
    while true do
        aktif = false
        if GetVehiclePedIsIn(PlayerPedId(), false) then
            if IsControlJustPressed(0, 38) then
                aktif = true
            end
        end
        Wait(0)
    end
end)

-- dengan fmid_loop + ox_lib
loop.create('klakson', function()
    aktif = true
end)

klakson = lib.addKeybind({
    name = 'klakson',
    description = 'test loop',
    defaultKey = 'E',
    onPressed = function(self)
        if cache.vehicle then
            loop.start('klakson')
        end
    end,
    onReleased = function(self)
        loop.stop('klakson')
        aktif = false
    end
})

klakson:disable(true)

lib.onCache('vehicle', function(b)
    klakson:disable(not b)
end)
```
