Ulysses Stuff > Ulysses Release Archives
AWarn 3.4 - Robust warning system
Duke Nukem:
MrPresident, when I try to warn someone, I get an "invalid strings" error, I'll edit it into the post later.
krackalackin:
This mod would be perfect with a user available report system.
nathan736:
--- Code: -----[[
ulx.DecayWarnings()
This function runs on a timer and removes 1 active warning from a players warning count. The player needs to be playing on the server
when this is called to have a warning removed.
]]
function ulx.DecayWarnings()
print("Decay timer running")
for _, pl in pairs ( player.GetAll() ) do
if pl.timewarned == 0 then pl.timewarned = 1 end -- prevents the line bellow from being 0 ever
if pl:TimeConnected( ) <= GetConVarNumber( "ulx_warnkick_decayrate" ) * 60 * pl.timewarned then continue end
if pl.warntable == nil then continue end
if pl.warntable["wcount"] == nil then continue end
if pl.warntable["wcount"] <= 0 then continue end
pl.warntable["wcount"] = pl.warntable["wcount"] - 1
ulx.WarningSave( pl )
pl.timewarned = pl.timewarned + 1
ULib.tsayColor(pl, Color(0,0,0,255), "AWarn: " , Color(255,255,255,255), "Your total warning count has been reduced by ", Color(255,0,0,255), "1")
end
timer.Create( "ULX_DecayTimer", 60, 1, ulx.DecayWarnings )
--timer.Create( "ULX_DecayTimer", GetConVarNumber( "ulx_warnkick_decayrate" ) * 60, 1, ulx.DecayWarnings ) -- keeping as a backup
end
timer.Create( "ULX_DecayTimer", 1, 1, ulx.DecayWarnings )
--- End code ---
http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index85a1.html
martus link for player time connected
http://ideone.com/WqnGdD
link for full code
i modifyed the decay timer code to update and check if the players connected time was higher then the time you set multiplied by the times he has already been decayed during that connection (because changing the code to player connect time required this) this should solve the derpy decay code that was there assuming i did not break anything :D
MrPresident:
The code you suggest would remove 1 warning from the player every 60 seconds assuming they'd been connected longer than the decay rate. This gives me an idea though.
Eccid:
Yeah, warnings aren't decaying at all on my server. I know you've got stuff going on so it's no rush. Just reporting it.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version