Author Topic: ulx.convar  (Read 4315 times)

0 Members and 1 Guest are viewing this topic.

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
ulx.convar
« on: May 22, 2013, 03:05:11 PM »
okay so these convars are killing me i can for the life of me figure out whats going on

heres the code
Code: [Select]
local Reports_Enabled = "1" -- Set this to 0 if you want to disable this script
local Reports_In_Logs = "1" -- Set this to 0 if you don't want to log reports in daily logs
local Reports_Interval = "120" -- The player can only report once then he need to wait this interval (seconds) before reporting again. 0 = no delay (not recommended)
local Reports_Folder = "ulx_logs" -- By default, in the same folder as others log files
-- End of config

local Reportenabled = ulx.convar( "ReportEnabled", Reports_Enabled, "<0-1> - Set this to 0 if you want to disable the report command.", ULib.ACCESS_SUPERADMIN)
local ReportInLogs = ulx.convar( "ReportInLogs", Reports_In_Logs, "<0-1> - Set this to 0 if you don't want to log reports in daily logs.", ULib.ACCESS_SUPERADMIN)
local ReportInterval = ulx.convar( "ReportInterval", Reports_Interval, "<time> - Time between 2 reports from the same player. Set this to 0 to disable.", ULib.ACCESS_SUPERADMIN)
local ReportFolder = ulx.convar( "ReporTFolder", Reports_Folder, "<folder> - The folder where to save the reports file.", ULib.ACCESS_SUPERADMIN)

The console is spitting out this error
Code: [Select]
[ERROR] addons/ulx/lua/ulx/modules/sh/report.lua:13: attempt to call field 'convar' (a nil value)
  1. unknown - addons/ulx/lua/ulx/modules/sh/report.lua:13
   2. include - [C]:-1
    3. unknown - addons/ulx/lua/ulx/cl_init.lua:17
     4. include - [C]:-1
      5. unknown - addons/ulx/lua/ulib/modules/ulx_init.lua:4
       6. include - [C]:-1
        7. unknown - addons/ulib/lua/ulib/cl_init.lua:23
         8. include - [C]:-1
          9. unknown - addons/ulib/lua/autorun/ulib_init.lua:5

Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ulx.convar
« Reply #1 on: May 22, 2013, 05:17:49 PM »
Are you setting ulx to something before hand? Because it's saying the function doesn't exist.
Experiencing God's grace one day at a time.

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: ulx.convar
« Reply #2 on: May 22, 2013, 05:29:27 PM »
im sorry but im not sure what you mean...
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ulx.convar
« Reply #3 on: May 22, 2013, 07:59:54 PM »
I'm trying to say something else is wrong in your file. It works fine if you run those commands in console:

Code: [Select]
lua_run  Reports_Enabled= "1"-- Set this to 0 if you want to disable this script
> Reports_Enabled= "1"-- Set this to 0 if you want to disable this script...
lua_run Reportenabled = ulx.convar( "ReportEnabled", Reports_Enabled, "<0-1> - Set this to 0 if you want to disable the report command.", ULib.ACCESS_
SUPERADMIN)
> Reportenabled = ulx.convar( "ReportEnabled", Reports_Enabled, "<0-1> - Set this to 0 if you want to disable the report command.", ULib.ACCESS_SUPERA
DMIN)...
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ulx.convar
« Reply #4 on: May 22, 2013, 08:20:43 PM »
Perhaps his script is somehow running before ulx.convar function has been set up in ULX init?
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ulx.convar
« Reply #5 on: May 23, 2013, 08:36:51 AM »
He has it as a module correctly though, and I can see that from the stack trace. I even verified that I didn't flub something in the ULX module loading order.
Experiencing God's grace one day at a time.

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: ulx.convar
« Reply #6 on: May 23, 2013, 12:08:05 PM »
could the error be that i didnt put it with in a function its just at the top of the file?
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ulx.convar
« Reply #7 on: May 23, 2013, 01:44:14 PM »
Don't think so. Please attach the file so we can look at it closer.
Experiencing God's grace one day at a time.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ulx.convar
« Reply #8 on: May 23, 2013, 01:45:32 PM »
Wait... I think I know what the problem is. That function doesn't exist on the clientside. Wrap the ulx.convar() bits in a "if SERVER then ... end".
Experiencing God's grace one day at a time.

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: ulx.convar
« Reply #9 on: May 23, 2013, 04:23:59 PM »
Thanks that fixed it.
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: ulx.convar
« Reply #10 on: May 23, 2013, 04:43:19 PM »
Unrelated but what did ulx.OnDoneLoading() become after the rewrite?
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ulx.convar
« Reply #11 on: May 24, 2013, 08:08:12 AM »
It became a hook -- which is what it should have been to start with. I think we only kept ulx.OnDoneLoading() for as long as we did for backward compatibility's sake. The hook name is "ULXLoaded".
Experiencing God's grace one day at a time.