attempt to call method 'chatprint' (a nil value)

Whenever I try to run this, it gives an error.



function myTestFunction()
	player.GetByID( 1 ):chatprint("Welcome Ivan")
end

concommand.Add("welcome", myTestFunction)



autorun/server/chatprint.lua:2: attempt to call method 'chatprint' (a nil value)

What am I doing wrong, or what am I totally missing?

Lua is case sensitive, it needs to be ChatPrint not chatprint.

Ok, that worked.

Half the problem was it was in the client folder (I had two copies by accident)

That is not a problem at all.

I’m trying to put an image on my menu. Right now, I’ve got a perfectly placed checkerboard of death. What format do I need to make my image and where do I put it? (I’ve got it packaged in addon format right now)

Can we see your code? Have you made sure the texture’s in the right format?

[lua]
local shopkeep_image = vgui.Create(“DImage”, frame1)
shopkeep_image:SetImage(“VGUI/hardware”)
shopkeep_image:SetPos(10,490)
shopkeep_image:SizeToContents()[/lua]

I tried both a jpeg and a vtf/vmt located in materials/VGUI of my addon folder, but I really don’t know where to put it or what format.

I’m no expert in DImages but according to the GMod Wiki page that looks fine. Also, textures have to be in vtf/vmt format to work with this sort of stuff, so you weren’t wrong there either.

The code will look for materials/VGUI/hardware.vtf and materials/VGUI/hardware.vmt

Does it make a difference if it is the main gmod folder or the materials folder in my addon?

What’s the full path of your material so far?

No, it shouldn’t matter. If you’ve got addons/myaddon/materials/VGUI/hardware.vtf (and vmt) then you should be able to treat them as if they’re in the main materials folder.

C:\Program Files\Steam\steamapps\eviltechie\garrysmod\garrysmod\addons\Store\materials\VGUI\hardware.vtf/.vmt

That seems fine to me.

The problem is that it doesn’t work.

[img_thumb]http://awardia.net/error.jpg[/img_thumb]

Show us the .vmt file.



"LightmappedGeneric"
{
	"$basetexture" "Users/Ivan/Desktop/hardware"
}


Change it to UnlitGeneric and change $basetexture to “vgui/hardware”