1

I want to create my own F4 menu for my server in Garry's Mod, and I want to set image of the background of the menu from PhotoShop, but in video lessons don't speak about it and show only how to change color of rectangle.I hope you help me

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)

the folder menu is in folder lua/autorun, but image looks like error texture(pink and black sqares) I think it hapens because server can't find this image, although if I paste the other image, that already exists in Garry's mod, it works but prints error. For example:

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)

errror: [ERROR] lua/autorun/noname.lua:1: attempt to index global 'vgui' (a nil value) 1. unknown - lua/autorun/noname.lua:1

pinkcat
  • 327
  • 4
  • 17

0 Answers0