ULX

Author Topic: Help with Watchlist  (Read 2273 times)

0 Members and 1 Guest are viewing this topic.

Offline Skarr

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Help with Watchlist
« on: March 26, 2016, 08:07:21 AM »
Hey guys so I'm not really getting any errors however the files are just not working, not sure if ulx is overpowering the files or not.

I've added the "Custom-ULX-Commands" from here: https://github.com/jkralicky/Custom-ULX-Commands

Mainly cause of the watch list presented via table format; https://github.com/jkralicky/Custom-...sh/cc_util.lua

Anyone that could know anything on how to get this working ?

Edit:

In chat it appears as: "Steb (STEAM ##) is on watchlist for RDM'ing" When the user joins that is okay, say i want to list the Watchlist and i have several users ? it wont fit in chat...

Code: [Select]
function ulx.watchlist(calling_ply)
watchlist = {}
for k, v in pairs(player.GetAll()) do
if v:GetPData("Watched") == "true" then
table.insert( watchlist, v:Nick())
table.insert(watchlist, v:GetPData("WatchReason"))
end
end
local watchstring = table.concat(  watchlist, "," )
ulx.fancyLogAdmin( nil, true,  "Watchlist: #s ",watchstring )
end
local watchlist = ulx.command("Essentials", "ulx watchlist", ulx.watchlist, "!watchlist",true)
watchlist:defaultAccess( ULib.ACCESS_ADMIN )
watchlist:help( "Prints watch list." )

Trying to get it to lodge like this as a watch list, or if not possible;

List the watchlist in chat ona new line:
Eg.
WatchList
---------
Name1 : Reason
Name2 : Reason
Name3 : Reason

but instead i get this:  (http://prntscr.com/ak93h0)

As you see it's missing 1 player.


PS. i am still new at all this and slowly learning it all. Anything help would be great :)

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Help with Watchlist
« Reply #1 on: March 26, 2016, 10:53:40 AM »
Don't use ulx fancylogadmin.
Use a standard chat print message.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Skarr

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Help with Watchlist
« Reply #2 on: March 26, 2016, 07:19:48 PM »
Any suggestions ?

Or what format i could use ?

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Help with Watchlist
« Reply #3 on: March 26, 2016, 09:10:43 PM »
ChatPrint - https://wiki.garrysmod.com/page/Player/ChatPrint
or
PrintMessage - https://wiki.garrysmod.com/page/Player/PrintMessage

Would have to use \n I think to get new line.

Personally, I wouldn't want a full list of names/reasons in my chat box.
Perhaps a single line saying 'check your console, warned players are currently connected' then see a list in console.
Or if getting fancy, some gui window or additional XGUI tab. (
But, that's just me.
Awarn 3 does the console list - https://forums.ulyssesmod.net/index.php?topic=5958.0
Good to learn from.

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

Offline Skarr

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Help with Watchlist
« Reply #4 on: March 26, 2016, 10:18:50 PM »
Yeah, like console doesnt work for all players, like i dont mind if it comes down as watchlist doesnt get viewed much and onyl shows from those online, it will just help, as right now it's blocking the test...

i will check what you said in a few mins and get back to you. Thanks for the help!

Offline Skarr

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Help with Watchlist
« Reply #5 on: March 27, 2016, 01:37:36 AM »
Hey,

Tried what you said seem to just break it, could you do an example please??

Code: [Select]
function ulx.watchlist(calling_ply)
watchlist = {}
for k, v in pairs(player.GetAll()) do
if v:GetPData("Watched") == "true" then
table.insert( watchlist, v:Nick())
table.insert(watchlist, v:GetPData("WatchReason"))
end
end
local watchstring = table.concat(  watchlist, "," )
ulx.fancyLogAdmin( nil, true,  "Watchlist: #s ",watchstring )
end
local watchlist = ulx.command("Essentials", "ulx watchlist", ulx.watchlist, "!watchlist",true)
watchlist:defaultAccess( ULib.ACCESS_ADMIN )
watchlist:help( "Prints watch list." )