Displaying a derma from another file?

Hello everyone, Im attempting to make this my final thread today.

Im basically making a addon for DarkRP and the addon has a entity and once you press use on the entity a derma will pop up. Im trying to keep things organised by giving the derma its own file in addonName/lua and im trying to call it from a entities init.lua located in addonName/lua/entities/entityname

The way im attempting to call it is with umsg.

This is my derma:


function drawTaxMenu()
	local taxMenu = vgui.Create( "DFrame" )
	taxMenu:SetPos(ScrW() / 2, ScrH() / 2)
	taxMenu:SetSize(300, 150)
	taxMenu:SetTitle("Tax menu")
	taxMenu:SetVisible( true )
	taxMenu:SetDraggable( false )
	taxMenu:ShowCloseButton( true )
	taxMenu:MakePopup()
end
usermessage.Hook( "Draw Tax Menu", drawTaxMenu )

This is my entity init.lua


function ENT:Use( activator, caller)
	umsg.Start( "Draw Tax Menu", activator )
	umsg.End()
	print("Message sent")

end

With the code above i get this: Warning: Unhandled usermessage ‘Draw Tax Menu’

What did i do wrong? :frowning:

Make sure the umsg receiver is in client-code, that why that error shows up because no usermessage on the client uses that.

Simple example of 3 networking methods: https://dl.dropboxusercontent.com/u/26074909/tutoring/networking/networking_channels_and_the_order_things_are_sent.lua ( seems like a queue is built, all net are sent / received first, then u, then concommands; I’d recommend looking into net messages )

Here’s an example for networking data; it shows how to have the client request data from the server, and the server respond: https://dl.dropboxusercontent.com/u/26074909/tutoring/networking/networking_player_identity_from_client_to_server_and_back.lua.html

You can put Lua that should be executed automatically ( such as your derma file ) without the need to use include or AddCSLuaFile into lua/autorun/client/ for client code, lua/autorun/server/ for server code and lua/autorun/ for shared. Your issue may be that it isn’t being included / executed.