Ulysses Stuff > Ulysses Release Archives
AWarn 3.4 - Robust warning system
JamminR:
--- Quote from: Jakers12342 on September 25, 2013, 01:59:10 PM ---How do i download this?
--- End quote ---
The little paperclip/filename/size info/how many times downloaded link at the bottom of the release/first post.
Jakers12342:
when i do !warn [name] [reason] it says You do not have access to this command and im SuperAdmin...What do i do?
MrPresident:
make sure you allow superadmin's to run ulx warn.
I believe you could do:
ulx groupallow superadmin "ulx warn"
rainbowdash:
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...
--- Code: ---table.insert(target_ply.warntable["warnings"], {os.date(), calling_ply:Nick(), reason})
--- End code ---
Change to
--- Code: ---table.insert(target_ply.warntable["warnings"], {os.date(), calling_ply:Nick() or "Console", reason})
--- End code ---
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,
--- Code: ---(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
--- End code ---
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.
--- Code: ---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
--- End code ---
EDIT: Lol missed an instance of calling_ply:Nick().. also may want to adjust that typo for the kickban reason.
MrPresident:
Nice catch! Thanks!
Updated to version 3.4
-Fixed the console warning a player returning a nil error for warning admin's name.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version