function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    -- Pobierz aktualną liczbę punktów gracza
    local resultId = db.storeQuery("SELECT `loyalty_points` FROM `players` WHERE `id` = " .. player:getGuid())
    local points = 0
    if resultId then
        points = result.getNumber(resultId, "loyalty_points")
        result.free(resultId)
    end

    -- Tworzenie okna modalnego
    local modal = ModalWindow(18472, "Loyalty Shop", "You have [" .. points .. "] loyalty points.\nChoose your reward:")

    for k, v in pairs(SHOP_ITEMS) do
        modal:addChoice(k, v.name .. " [" .. v.cost .. " pts]")
    end

    modal:addButton(100, "Buy")
    modal:addButton(101, "Cancel")
    modal:setDefaultEnterButton(100)
    modal:setDefaultEscapeButton(101)
    player:registerEvent("LoyaltyModal") -- na wypadek gdyby nie był zarejestrowany
    modal:sendToPlayer(player)
    return true
end
