Garrys Mod Atlas ChatBox

时间:2015-07-11 18:52:06

标签: lua garrys-mod

目前,我已经安装了ulx和ulib,它们是免费使用的admin mod插件,我安装了一个名为atlaschat的聊天箱,它是garrysmod的自定义聊天框,现在我已经查看了ulib和ulx,我我还不是很擅长lua,但我确实想成为一个。

这可能是最愚蠢的问题,我希望那些人可以教我如何做到这一点,所以将来我可以为自己做这件事。

- 代码开始

local expression = atlaschat.expression.New("< hsv >(.-)< /hsv >")

function expression:Execute(base, text)
    local label = atlaschat.GenericLabel()
    label:SetParent(base)
    label:SetText(text)
    label:SetColor(color_white)
    label:SizeToContents()

    label.color = color_white

    function label:Think()
        local hue = math.abs(math.sin(CurTime() *0.9) *335)

        self.color = HSVToColor(hue, 1, 1)

        self:SetColor(self.color)
    end

    return label
end

function expression:GetExample(base)
    local label = base:Add("DLabel")
    label:SetText("This is a hsv text")
    label:SetColor(color_white)
    label:SizeToContents()

    label.color = color_white

    function label:Think()
        local hue = math.abs(math.sin(CurTime() *0.9) *335)

        self.color = HSVToColor(hue, 1, 1)

        self:SetColor(self.color)
    end

    return "<hsv>This is a hsv text</hsv>", label
end

- 代码结束。

我要添加的内容非常简单,就是这个功能只能由某个ply:IsUserGroup("owner")使用 这可能吗?

0 个答案:

没有答案