我想在Garry's 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'(nil值) 1.未知-lua / autorun / noname.lua:1