function ulx.warn( calling_ply, target_ply )
target_ply = t
numberofwarns = t:GetPData("WarnData") or 0
if numberofwarns == 0 then
t:SetPData("WarnData", numberofwarns+1)
elseif numberofwarns == 1 then
t:SetPData("WarnData", numberofwarns+1)
time = 60
t:Ban(time, "You have been warned two times! Therefor are banned for 60 minutes!")
elseif numberofwarns == 2 then
t:SetPData("WarnData", numberofwarns+1)
time = 1440
t:Ban(time, "You have been warned three times! Therefor are banned for 1 day!")
elseif numberofwarns == 3 then
t:SetPData("WarnData", numberofwarns+1)
time = 10080
t:Ban(time, "You have been warned three times! Therefor are banned for 1 week!")
elseif numberofwarns > 3 then
time = 0
t:SetPData("WarnData", numberofwarns+1)
t:Ban(time, "You have been warned three times! Therefor are banned for 1 week!")
end
if numberofwarns < 1 then
ulx.fancyLogAdmin( calling_ply, "#A has warned #T for the first time! Be careful, #T", target_ply)
else
ulx.fancyLogAdmin( calling_ply, "#A has warned #T, and has been banned for #i minutes.", target_ply, tostring(time))
end
end
local warn = ulx.command( CATEGORY_NAME, "ulx warn", ulx.warn, {"!warn", "!w"})
warn:addParam{ type=ULib.cmds.PlayerArg }
warn:defaultAccess( ULib.ACCESS_ADMIN )
warn:help("Adds a warn to the target")
function ulx.unwarn( calling_ply, target_ply )
numberofwarns = t:GetPData("WarnData") or 0
if numberofwarns == 0 then
calling_ply:PrintMessage( HUD_PRINTTALK, target_ply:Nick().."'s warns are 0, unable to remove a warn!")
else
t:SetPData("WarnData", numberofwarns-1)
ulx.fancyLogAdmin( calling_ply, "#A has removed one warn from #T", target_ply)
end
end
local unwarn = ulx.command( CATEGORY_NAME, "ulx unwarn", ulx.unwarn, {"!unwarn", "!uw"})
unwarn:addParam{ type=ULib.cmds.PlayerArg }
unwarn:defaultAccess( ULib.ACCESS_ADMIN )
unwarn:help("Removed a warn to the target")
function ulx.viewwarns( calling_ply, target_ply )
numberofwarns = t:GetPData("WarnData") or "0"
calling_ply:PrintMessage( HUD_PRINTTALK, target_ply:Nick().."has ("..tostring(numberofwarns)..") warn(s)")
end
local vwarn = ulx.command( CATEGORY_NAME, "ulx viewwarns", ulx.viewwarns, {"!viewwarns", "!vw"})
vwarn:addParam{ type=ULib.cmds.PlayerArg }
vwarn:defaultAccess( ULib.ACCESS_ADMIN )
vwarn:help("Views a target's WarnData.")