ULX

Author Topic: A seperate MOTD for players and staff  (Read 1223 times)

0 Members and 1 Guest are viewing this topic.

Offline HeisenTwerk

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
A seperate MOTD for players and staff
« on: August 18, 2014, 01:44:26 PM »
I've created a seperate MOTD for both player and server staff usergroups, but I can't seem to get it to work. Is it possible? If yes, how?
I've tried to set ifs in the menus.lua file, not sure if i did something wrong or it's just not possible.
Here is the first part of the menus.lua file, I've edited the sendMotd function.
Code: [Select]
local CATEGORY_NAME = "Menus"

if ULib.fileExists( "lua/ulx/modules/cl/motdmenu.lua" ) or ulx.motdmenu_exists then
CreateConVar( "motdfile", "ulx_motd.txt" ) -- Garry likes to add and remove this cvar a lot, so it's here just in case he removes it again.
CreateConVar( "adminmotdfile", "ulx_admin_motd.txt" ) -- Staff motd cvar
local function sendMotd( ply, showMotd )
if showMotd == "1" then -- Assume it's a file
if ply:IsUserGroup('moderator') or ply:IsUserGroup('admin') or ply:IsUserGroup('superadmin') then
if ply.ulxHasMotd then return end -- This player already has the motd
if not ULib.fileExists( GetConVarString( "adminmotdfile" ) ) then return end -- Invalid
local f = ULib.fileRead( GetConVarString( "adminmotdfile" ) )
end
if ply:IsUserGroup('user') or ply:IsUserGroup('regular') or ply:IsUserGroup('loyal') or ply:IsUserGroup('veteran') or ply:IsUserGroup('nolifer') or ply:IsUserGroup('goldnolifer') then
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
ULib.clientRPC( ply, "ulx.rcvMotd", false, f )

ply.ulxHasMotd = true