Functions

Functions are events that are called on items, with (usually) the player who owns the item being the first argument, and then event specific extra arguments.

CATEGORY:CanPlayerSee(ply)

Required: No
Arguments: Player ply
Realm: Shared
Description: Called when adding tabs to the menu and when buying an item.

function CATEGORY:CanPlayerSee(ply)
    return ply:IsAdmin() -- Only admins
end

CATEGORY:ModifyTab(tab)

Required: No
Arguments: DPanel tab
Realm: Client
Description: Called when the tab is added to the PointShop menu.

function CATEGORY:ModifyTab(tab)
    local button = vgui.Create('DButton', tab)

    button:SetText('Click me!')
    button:Dock(BOTTOM)

    button.DoClick = function()
        Derma_Message('You clicked the button!', 'CLICKED', 'OK')
    end
end
comments powered by Disqus