ULX Motd Print Message on new Players screen

Is there a way to print a message on a new player’s screen (that is not staff) after they close the Motd? Like this

http://s7.postimg.org/x5v20njtl/Untitled_3s.jpg

-snip-

PLAYER:PrintMessage

Ok, but how do i make it so it only shows it to players that are not staff and have already joined the server?

You check for their groups and you print it after they closed the motd

I don’t understand.

Where ever the motd is created in, the file, in the close buttons do doclick method you check if the player is not staff, and if so print a message. The concept isn’t hard, just experiment.

What is the hook for check if the player is not staff? Btw I can post the code if you want?

Dude, have some basic lua coding before coming to facepunch…
Anyways, you’re using ULX, so use


if ply:CheckGroup( "Blah" ) then return true
    elseif ply:CheckGroup( "Some other group" ) then return true
    else
          --The print message stuff here
    end
end

Remember that CheckGroup works on inherits. So if you do ply:CheckGroup( “admin” ) you don’t need to do ply:CheckGroup( “superadmin” )

Also, I went afk while writing this, so I may have been ninja’d. 2lazy2edit

I tried just the Player:PrintMessage hook, but it gives me this error

[ERROR] addons/ulx/lua/ulx/modules/cl/motdmenu.lua:37: attempt to index global ‘Player’ (a function value)

  1. fn - addons/ulx/lua/ulx/modules/cl/motdmenu.lua:37
  2. func - addons/ulib/lua/ulib/client/cl_util.lua:22
    3. unknown - lua/includes/modules/net.lua:32

local button = vgui.Create( "DButton", window )
	button:SetText( "Close" )
	button.DoClick = function() window:Close () end
	button:SetSize( 100, 40 )
	button:SetPos( (window:GetWide() - button:GetWide()) / 2, window:GetTall() - button:GetTall() - 10 )
    Player:PrintMessage ( HUD_PRINTCENTER, "By joining this server, it is assumed you have read the rules. If staff sees you break any rules, punishments will be forced." )  --The print message stuff here


First of all, I really hope that’s a typo and that you don’t actually have “–The print message stuff here” in your code.
Second of all, what is that?
It’s in no way what Scouter or I told you…


button.DoClick = function() window:Close () end

The DoClick function ends there (That’s when you need to define player btw), so the print message stuff need to go there.

And I quote myself, pleaes get some basic lua knowledge before coming to facepunch

I have no idea how to define player, I know I know, you want me to have basic lua knowledge but if you don’t mind helping me that would be greatly appreciated. If not that’s fine.

Btw what do you mean “Second of all, what is that?” - (button.DoClick = function() window:Close () end)

He’s saying move the Player:PrintMessage peice into the buttun.DoClick


button.DoClick = function() window:Close () PLAYER:PrintMessage ( HUD_PRINTCENTER, "By joining this server, it is assumed you have read the rules. If staff sees you break any rules, punishments will be forced." ) end

Like this?

Player should be LocalPlayer() and test code before coming to us.

I tested this code and it doesn’t do anything and no errors.

Here is the code-


local button = vgui.Create( "DButton", window )
	button:SetText( "Close" )
	button.DoClick = function() window:Close ()  LocalPlayer():PrintMessage ( HUD_PRINTCENTER, "By joining this server, it is assumed you have read the rules. If staff sees you break any rules, punishments will be forced." ) end
	button:SetSize( 100, 40 )
	button:SetPos( (window:GetWide() - button:GetWide()) / 2, window:GetTall() - button:GetTall() - 10 )

I feel like i did something very stupid ^

So does anyone know what I did wrong?