Custom Commands

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-ULX-Commands/blob/master/CustomCommands_onecategory/lua/ulx/modules/sh/cc_util.lua

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

Thanks

PS. i am still new at all this and slowly learning it all

Just to be sure, you added the files here ‘garrysmod/garrysmod/addons/ULX/lua/ulx/modules/sh’ (this could vary). Correct?

No i didnt think that was i added the “Custom-ULX-Commands” to the “garrysmod/garrysmod/addons” as the other commands work, just not the watchlist

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…


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.

Like i said i am still all new to this, any help would be great!! on an easier solution

-Bump-

  • bump -

ulx.fancyLogAdmin is printing watchstring, which is created via table.concat.
table.concat concatenates the contents of a table to a string using the provided “concatenator”. You can change the concatenator to your liking (
adds a new line).

What would the code be tho please?

Would that be right ?

No. This is coding 101, please have a little bit of knowledge if you’re gonna post in the Dev section

If you read above Jason i am still learning all this. If i knew i wouldn’t be posting or asking for help

Ok then, regarding this attempt [lua]ulx.fancyLogAdmin( nil, true, "Watchlist: #s ",watchstring
)[/lua]
1)
needs to be inside a string to create a new line
2) The argument “*watchstring
*” is invalid, it’ll return a “) expected near” error
2) *A function takes in arguments, that are seperated via commas. Writing two arguments with no comma in between will always result in an error
3) Since I said this:

I have no idea why you even edited fancyLogAdmin, that has nothing to do with what I said. Instead, edit the concatenator in table.concat

Okay thanks,

Any links you can provide where i can read up and learn this ?

Garry’s Mod Wiki <-- This will generally help you when you want to do something specific, or learn something specific
The Official Lua Documentation <-- This is an amazing source for step-by-step learning
This thread <-- Although it’s old, the thread has pretty good references