Not sure if its fixed, but there was an issue with warning players from the server console, as Nick() would return nil because the console has no nickname, the warning would not occur correctly...
Just looked at the latest version. Doesn't appear to be fixed... My fix for it is like this...
table.insert(target_ply.warntable["warnings"], {os.date(), calling_ply:Nick(), reason})
Change to
table.insert(target_ply.warntable["warnings"], {os.date(), calling_ply:Nick() or "Console", reason})
Should solve the error that people get when warning players from the server console or from rcon.
EDIT: That fix doesnt work, I applied it a while ago, restarted, just tested it,
(Console) warned Batman (Test, unwarn whenever)
ServerLog: [ULX] (Console) warned Batman (Test, unwarn whenever)
L 10/16/2013 - 19:47:47: [ULX] (Console) warned Batman (Test, unwarn whenever)
L 10/16/2013 - 19:47:47: Lua Error:
[ERROR] addons/ulx_warn/lua/ulx/modules/sh/warn.lua:61: attempt to call method 'Nick' (a nil value)
1. AddWarning - addons/ulx_warn/lua/ulx/modules/sh/warn.lua:61
2. call - addons/ulx_warn/lua/ulx/modules/sh/warn.lua:31
3. __fn - addons/ulib/lua/ulib/shared/commands.lua:943
4. unknown - addons/ulib/lua/ulib/shared/commands.lua:1296
5. unknown - lua/includes/modules/concommand.lua:69
[ERROR] addons/ulx_warn/lua/ulx/modules/sh/warn.lua:61: attempt to call method 'Nick' (a nil value)
1. AddWarning - addons/ulx_warn/lua/ulx/modules/sh/warn.lua:61
2. call - addons/ulx_warn/lua/ulx/modules/sh/warn.lua:31
3. __fn - addons/ulib/lua/ulib/shared/commands.lua:943
4. unknown - addons/ulib/lua/ulib/shared/commands.lua:1296
5. unknown - lua/includes/modules/concommand.lua:69
As another (blind) attempt, I stole a leaf out of my old book used in my DarkRP HUD, by storing calling_ply in a local variable, and then checking if the variable contains a string, and if not, set it to "Console"... which was an errorcheck i put in my hud to stop errors from spamming when a player first joins and their wallet hasn't loaded.
function ulx.AddWarning( target_ply, calling_ply, reason )
local safenick = calling_ply:Nick()
if not safenick then safenick = "Console" end
if target_ply.warntable == nil then
target_ply.warntable = {}
end
if target_ply.warntable["wcount"] == nil then
target_ply.warntable["wcount"] = 0
end
if target_ply.warntable["warnings"] == nil then
target_ply.warntable["warnings"] = {}
end
table.insert(target_ply.warntable["warnings"], {os.date(), safenick, reason})
target_ply.warntable["wcount"] = target_ply.warntable["wcount"] + 1
ULib.tsayColor(target_ply, Color(0,0,0,255), "AWarn: " , Color(255,255,255,255), "You were warned by ", Color(0,0,0,255), "(", Color(0,255,0,255), safenick, Color(0,0,0,255), ")", Color(255,255,255,255), " for: ", Color(255,0,0,255), reason)
if target_ply.warntable["wcount"] >= GetConVarNumber( "ulx_warnkick_num" ) then
if GetConVarNumber( "ulx_warnkick_ban" ) == 0 then
target_ply.warntable["wcount"] = target_ply.warntable["wcount"] - 1
ulx.WarningSave( target_ply )
ULib.kick( target_ply, "Warning threshold exceeded" )
else
local btime = tostring( GetConVarNumber( "ulx_warnkick_bantime" ) )
target_ply.warntable["wcount"] = target_ply.warntable["wcount"] - 1
ulx.WarningSave( target_ply )
ULib.kickban( target_ply, GetConVarNumber( "ulx_warnkick_bantime" ), "Warning threshold exceededm Banned for (" .. btime .. ") minutes.", calling_ply )
end
else
ulx.WarningSave( target_ply )
end
end
EDIT: Lol missed an instance of calling_ply:Nick().. also may want to adjust that typo for the kickban reason.