如何在Garry'中的玩家屏幕上放置图像;s mod lua服务器

如何在Garry'中的玩家屏幕上放置图像;s mod lua服务器,lua,garrys-mod,Lua,Garrys Mod,我想在Garry的Mod中为我的服务器创建我自己的F4菜单,我想从PhotoShop中设置菜单的背景图像,但在视频课程中,不要谈论它,只显示如何更改矩形的颜色。我希望你能帮助我 local image = vgui.Create('DImage', frame) image:SetSize(800, 600) image:SetPos(100, 100) image:SetImage('menu/image.gif') local function DisplayNotify(msg)

我想在Garry的Mod中为我的服务器创建我自己的F4菜单,我想从PhotoShop中设置菜单的背景图像,但在视频课程中,不要谈论它,只显示如何更改矩形的颜色。我希望你能帮助我

local image = vgui.Create('DImage', frame)
image:SetSize(800, 600)
image:SetPos(100, 100)
image:SetImage('menu/image.gif')

local function DisplayNotify(msg)
    local txt = msg:ReadString()
    GAMEMODE:AddNotify(txt, msg:ReadShort(), msg:ReadLong())
    surface.PlaySound("buttons/lightswitch2.wav")

    MsgC(Color(255, 20, 20, 255), "[DarkRP] ", Color(200, 200, 200, 255), txt, "\n")
end
usermessage.Hook("_Notify", DisplayNotify)
文件夹菜单位于文件夹lua/autorun中,但图像看起来像错误纹理(粉色和黑色正方形) 我想这可能是因为服务器找不到这张图片,虽然如果我粘贴另一张图片,这张图片已经存在于Garry的mod中,它可以工作,但打印错误。 例如:

local image = vgui.Create('DImage', frame)
image:SetSize(800, 600)
image:SetPos(100, 100)
image:SetImage('icon16/bug.png')

local function DisplayNotify(msg)
local txt = msg:ReadString()
GAMEMODE:AddNotify(txt, msg:ReadShort(), msg:ReadLong())
surface.PlaySound("buttons/lightswitch2.wav")

MsgC(Color(255, 20, 20, 255), "[DarkRP] ", Color(200, 200, 200, 255), txt, "\n")
end
usermessage.Hook("_Notify", DisplayNotify)
错误: [错误]lua/autorun/noname.lua:1:尝试索引全局“vgui”(一个空值)
1.未知-lua/autorun/noname.lua:1提供更多上下文,添加引用链接,显示一些自己的代码。请阅读我添加的代码和上下文提供更多上下文,添加参考链接,显示一些自己的代码。请阅读我添加的代码和上下文