Ulysses
General => Developers Corner => Topic started by: bender180 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
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
[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
-
Are you setting ulx to something before hand? Because it's saying the function doesn't exist.
-
im sorry but im not sure what you mean...
-
I'm trying to say something else is wrong in your file. It works fine if you run those commands in console:
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)...
-
Perhaps his script is somehow running before ulx.convar function has been set up in ULX init?
-
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.
-
could the error be that i didnt put it with in a function its just at the top of the file?
-
Don't think so. Please attach the file so we can look at it closer.
-
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".
-
Thanks that fixed it.
-
Unrelated but what did ulx.OnDoneLoading() become after the rewrite?
-
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".