General > Developers Corner
How to disable ulx motd from displaying for staff
JamminR:
Sorry, got your question mixed up with someone else trying to stop motd totally.
It was late. I was tired. I'll go find that thread and post my same answer there. :D
Megiddo:
Before
`if showMotd == "1" then`
in menus.lua
add
`if ply:IsAdmin() then return end` (or whatever logic you need for the groups you're exempting)
Storm:
Thanks so much! Does inheritance work with this? If I put moderator, will it work for all groups above?
Decicus:
--- Quote from: Storm on February 10, 2014, 04:47:14 AM ---Thanks so much! Does inheritance work with this? If I put moderator, will it work for all groups above?
--- End quote ---
IsAdmin() will work for groups that inherit from the default "admin" group. If it's only moderator you're worried about (and there's no group between "moderator" and "admin" or "moderator" and "user") that you want to disable the MOTD for, you can do something like this:
--- Code: ---if ply:IsAdmin() or ply:IsUserGroup( "moderator" ) then return end
--- End code ---
(This is just an edit from Megiddo's suggestion)
Storm:
Thanks. This is what I now have in that file:
--- Code: --- local function sendMotd( ply, showMotd )
if ply:IsAdmin() or ply:IsUserGroup( "moderator" ) then return end
if showMotd == "1" then -- Assume it's a file
if ply.ulxHasMotd then return end -- This player already has the motd
if not ULib.fileExists( GetConVarString( "motdfile" ) ) then return end -- Invalid
local f = ULib.fileRead( GetConVarString( "motdfile" ) )
--- End code ---
For some reason this has no effect (the motd still comes up for all groups.) Can you tell me what I am doing wrong?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version