• Print

Author Topic: #A Issue, this really does confuse me  (Read 6165 times)

0 Members and 1 Guest are viewing this topic.

Offline lKarma

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
#A Issue, this really does confuse me
« on: February 07, 2017, 05:15:41 pm »
Hey guys,
Allow me to make a disclaimer and say I am not that experienced in LUA, nor ULX.

So here's my issue, any ULX command that has no target such as !cleardecals or our own custom commands they come back with an echo that says for example "#A has cleared the decals" rather then calling the players name.

Now I don't know if this is a server side error or its the code its self so I am going to post all the code that could be causing an issue.

Code: Lua
  1. ------------------------Chat Facepalm------------------------
  2.  
  3. function ulx.facepalm( calling_ply, target_ply )
  4.  
  5.         ulx.fancyLogAdmin( calling_ply, "#A facepalms", target_ply )
  6. end
  7. local facepalm = ulx.command( CATEGORY_NAME, "ulx facepalm", ulx.facepalm, "!facepalm" )
  8. facepalm:defaultAccess( ULib.ACCESS_ADMIN )
  9. facepalm:help( "Show people how disappointed you are of them!" )

Code: Lua
  1. ------------------------Clear Decals------------------------
  2.         function ulx.cleardecals( calling_ply )
  3.  
  4.         for _,v in ipairs( player.GetAll() ) do
  5.                
  6.                 v:ConCommand("r_cleardecals")
  7.                
  8.         end
  9.        
  10.         ulx.fancyLogAdmin( calling_ply, "#A cleared decals" )
  11.        
  12. end
  13. local cleardecals = ulx.command( "Essentials", "ulx cleardecals", ulx.cleardecals, {"!cd", "!cleardecals"} )
  14. cleardecals:defaultAccess( ULib.ACCESS_ADMIN )
  15. cleardecals:help( "Clear decals for all players." )



Any help or ideas will be appreciated, i've tried everything I could think of.
Thanks
« Last Edit: February 07, 2017, 05:22:08 pm by lKarma »

Offline BlueNova

  • Full Member
  • ***
  • Posts: 113
  • Karma: 13
  • The most powerful force in the universe.
Re: #A Issue, this really does confuse me
« Reply #1 on: February 07, 2017, 05:42:41 pm »
You have "target_ply" as a parameter when you aren't targeting anyone. It should look more like this, I think.

Code: Lua
  1. function ulx.facepalm( calling_ply )
  2.  
  3. --Some stuff goes here just for some fun--
  4.  
  5.           ulx.fancyLogAdmin( calling_ply, "#A has facepalmed!", affected_plys )
  6.  
  7. end
  8.  
  9.  

"affected_plys" may or may not be needed but I'm fairly certain that's what your issue is.

Offline lKarma

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: #A Issue, this really does confuse me
« Reply #2 on: February 07, 2017, 05:47:11 pm »
You have "target_ply" as a parameter when you aren't targeting anyone. It should look more like this, I think.

Code: Lua
  1. function ulx.facepalm( calling_ply )
  2.  
  3. --Some stuff goes here just for some fun--
  4.  
  5.           ulx.fancyLogAdmin( calling_ply, "#A has facepalmed!", affected_plys )
  6.  
  7. end
  8.  
  9.  

"affected_plys" may or may not be needed but I'm fairly certain that's what your issue is.

This makes sense, but doesn't explain !cleardecals, I have tried removing "target_ply" before to no avail.
The !cleardecals has no target so shouldn't it still be putting the players name instead of #A?

Offline BlueNova

  • Full Member
  • ***
  • Posts: 113
  • Karma: 13
  • The most powerful force in the universe.
Re: #A Issue, this really does confuse me
« Reply #3 on: February 07, 2017, 06:59:08 pm »
If even cleardecals is displaying "#A cleared decals" instead of the players name then it may be something with the log.lua file. Unless you have any errors from you console? That's what I would think anyways.

Offline lKarma

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: #A Issue, this really does confuse me
« Reply #4 on: February 07, 2017, 07:01:20 pm »
Code: Lua
  1. [ERROR] addons/customcommandsonecategory/lua/ulx/modules/sh/cc_menus.lua:64: bad argument #2 to ULib.cmds.TranslateCommand (function expected)
  2.   1. error - [C]:-1
  3.    2. checkArg - addons/ulib/lua/ulib/shared/misc.lua:585
  4.     3. instantiate - addons/ulib/lua/ulib/shared/commands.lua:1078
  5.      4. ulxCommand - addons/ulib/lua/ulib/shared/misc.lua:968
  6.       5. command - addons/ulx/lua/ulx/sh_base.lua:60
  7.        6. unknown - addons/customcommandsonecategory/lua/ulx/modules/sh/cc_menus.lua:64
  8.         7. include - [C]:-1
  9.          8. unknown - addons/ulx/lua/ulx/init.lua:34
  10.           9. include - [C]:-1
  11.            10. unknown - addons/ulx/lua/ulib/modules/ulx_init.lua:2
  12.             11. include - [C]:-1
  13.              12. unknown - addons/ulib/lua/ulib/init.lua:74
  14.               13. include - [C]:-1
  15.                14. unknown - addons/ulib/lua/autorun/ulib_init.lua:3
  16.  
  17. //  MODULE: cc_notepad.lua   //
  18. //  MODULE: cc_pgag.lua      //
  19. //  MODULE: cc_query.lua     //
  20.  
  21. [ERROR] addons/customcommandsonecategory/lua/ulx/modules/sh/cc_query.lua:3: Couldn't load module library!
  22.  1. require - [C]:-1
  23.   2. unknown - addons/customcommandsonecategory/lua/ulx/modules/sh/cc_query.lua:3
  24.    3. include - [C]:-1
  25.     4. unknown - addons/ulx/lua/ulx/init.lua:34
  26.      5. include - [C]:-1
  27.       6. unknown - addons/ulx/lua/ulib/modules/ulx_init.lua:2
  28.        7. include - [C]:-1
  29.         8. unknown - addons/ulib/lua/ulib/init.lua:74
  30.          9. include - [C]:-1
  31.           10. unknown - addons/ulib/lua/autorun/ulib_init.lua:3

These are the only errors that occur upon mounting the modules.
« Last Edit: February 07, 2017, 07:15:31 pm by lKarma »

Offline BlueNova

  • Full Member
  • ***
  • Posts: 113
  • Karma: 13
  • The most powerful force in the universe.
Re: #A Issue, this really does confuse me
« Reply #5 on: February 07, 2017, 07:48:44 pm »
Ok so I got a bit sidetracked in trying to solve this and made you an alternative that I found to work when testing it in game.

Rather than trying to use ulx.fancyLogAdmin I used ULib.tsay and got essentially the same thing. Try this out and see if it suits your needs.

Code: Lua
  1. local CATEGORY_NAME = "Facepalm"
  2.  
  3. function ulx.facepalm( calling_ply )
  4.  
  5.     for k, v in pairs( player.GetAll() ) do
  6.         ULib.tsay( v, calling_ply:Nick() .. " has facepalmed!" )
  7.     end
  8.  
  9. end
  10.  
  11. local facepalm = ulx.command( CATEGORY_NAME, "ulx facepalm", ulx.facepalm, "!facepalm" )
  12. facepalm:defaultAccess( ULib.ACCESS_ALL )
  13. facepalm:help( "Facepalms to show disappointment." )

Offline lKarma

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: #A Issue, this really does confuse me
« Reply #6 on: February 07, 2017, 08:14:52 pm »
I'll try it, Thanks!

Offline lKarma

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: #A Issue, this really does confuse me
« Reply #7 on: February 07, 2017, 09:10:30 pm »
This solves my issue at this moment thanks again!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: #A Issue, this really does confuse me
« Reply #8 on: February 08, 2017, 03:53:55 pm »
ikarma, you're using a custom chatbox.
Have you tried your code without a custom chat box?
I could imagine it literally printing #A, instead of normal Gmod lua filling in the variable #A with calling player.
Though the code given to you will do what you want off-hand, it won't log the player's 'attack' using ULX log settings, or follow ULX's echo modes.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

  • Print