General > Developers Corner

ulx.convar

(1/3) > >>

bender180:
okay so these convars are killing me i can for the life of me figure out whats going on

heres the code

--- Code: ---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)
--- End code ---

The console is spitting out this error

--- Code: ---[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


--- End code ---

Megiddo:
Are you setting ulx to something before hand? Because it's saying the function doesn't exist.

bender180:
im sorry but im not sure what you mean...

Megiddo:
I'm trying to say something else is wrong in your file. It works fine if you run those commands in console:


--- Code: ---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)...

--- End code ---

JamminR:
Perhaps his script is somehow running before ulx.convar function has been set up in ULX init?

Navigation

[0] Message Index

[#] Next page

Go to full version