ULX

Author Topic: Achatter admin chat *FIX*  (Read 2064 times)

0 Members and 1 Guest are viewing this topic.

Offline BobTheDuck69

  • Newbie
  • *
  • Posts: 33
  • Karma: 1
Achatter admin chat *FIX*
« on: March 13, 2015, 05:01:05 PM »
First of all i need an admin to remove my old post second i dont know where to add the category for the command thats broken in startup
Code: [Select]
local seeachatterAccess = "ulx seeachatter"
if SERVER then ULib.ucl.registerAccess( seeachatterAccess, ULib.ACCESS_OPERATOR, "Ability to see 'ulx achatter'", "Other" ) end -- Give operators access to see achatters echoes by default

function ulx.achatter( calling_ply, message )
local format
local me = "/me "
if message:sub( 1, me:len() ) == me then
format = "(ADMINS) *** #P #s"
message = message:sub( me:len() + 1 )
else
format = " <Achatter> #P #s"
end

local players = player.GetAll()
for i=#players, 1, -1 do
local v = players[ i ]
if not ULib.ucl.query( v, seeachatterAccess ) and v ~= calling_ply then -- Calling player always gets to see the echo
table.remove( players, i )
end
end

ulx.fancyLog( players, format, calling_ply, message )
end
local achatter = ulx.command( CATEGORY_NAME, "ulx achatter", ulx.achatter, "!achatter", true, true )
achatter:addParam{ type=ULib.cmds.StringArg, hint="message", ULib.cmds.takeRestOfLine }
achatter:defaultAccess( ULib.ACCESS_ALL )
achatter:help( "Send a message to admins in the chat." )
~The friendly neighborhood duckie~

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Achatter admin chat *FIX*
« Reply #1 on: March 13, 2015, 10:19:49 PM »
Either define CATEGORY_NAME somewhere before it's called in command setup, or change it from a var to a string.
The error (which you didn't post) is pretty clear about that (nil)


"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given