# Scoreboard integration

An example code is available to use in your scoreboard if you want badges integration.

```glua
// Check if ashop is on the server
if ashop then 
    // Retrieve badges of this player, will always return a table
    local badges = ashop.GetPlayerBadges(THE_PLAYER)

    /*
    v:
        desc: String, description of the badge
        mat: Function. Call it every paint to get the material. 
            THIS CAN RETURN A NIL VALUE !
        name: String, name of the badge, used for the item name.
    */
    
    for k, v in pairs(badges) do
        local badge = vgui.Create("DPanel", subPnl)
        badge:Dock(LEFT)
        badge:SetMouseInputEnabled(true)
        badge:SetTooltipPanelOverride("Flux_Tooltip")
        badge:SetTooltip(v.desc)

        function badge:Paint(w, h)
            local m = v.mat()
                        
            if m then
                surface.SetMaterial(m)
                surface.SetDrawColor(color_white)
                surface.DrawTexturedRect(0, 0, w, h)
            end
        end
    end
end
```

You can use this template to add compatibility with your scoreboard.

You may need to resize the badge, etc...


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://akulla-pro.gitbook.io/ashop/for-devs/scoreboard-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
