• Custom Commands
    12 replies, posted
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: [url]https://github.com/jkralicky/Custom-ULX-Commands[/url] Mainly cause of the watch list presented via table format; [url]https://github.com/jkralicky/Custom-ULX-Commands/blob/master/CustomCommands_onecategory/lua/ulx/modules/sh/cc_util.lua[/url] 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... [CODE]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." )[/CODE] 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: [IMG]http://prntscr.com/ak93h0[/IMG] ([url]http://prntscr.com/ak93h0[/url]) 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 (\n adds a new line).
[QUOTE=JasonMan34;50038891]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 (\n adds a new line).[/QUOTE] What would the code be tho please? [QUOTE] local watchstring = table.concat( watchlist, "," ) ulx.fancyLogAdmin( nil, true, "Watchlist: #s ",watchstring \n ) [/QUOTE] Would that be right ?
[QUOTE=Steev2;50039403]What would the code be tho please? Would that be right ?[/QUOTE] 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
[QUOTE=Steev2;50044623]If you read above Jason i am still learning all this. If i knew i wouldn't be posting or asking for help[/QUOTE] Ok then, regarding this attempt [lua]ulx.fancyLogAdmin( nil, true, "Watchlist: #s ",watchstring \n )[/lua] 1) \n needs to be inside a string to create a new line 2) The argument "[I]watchstring \n[/I]" 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: [QUOTE=JasonMan34;50038891]table.concat concatenates the contents of a table to a string using the provided "concatenator". You can change the concatenator to your liking (\n adds a new line).[/QUOTE] 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 ?
[QUOTE=Steev2;50045442]Okay thanks, Any links you can provide where i can read up and learn this ?[/QUOTE] [URL="http://wiki.garrysmod.com/page/Main_Page"]Garry's Mod Wiki[/URL] <-- This will generally help you when you want to do something specific, or learn something specific [URL="http://www.lua.org/pil/1.html"]The Official Lua Documentation[/URL] <-- This is an amazing source for step-by-step learning [URL="https://facepunch.com/showthread.php?t=1337945"]This thread[/URL] <-- Although it's old, the thread has pretty good references
Sorry, you need to Log In to post a reply to this thread.