function DSR.CallAdmin( ply, text, force )
if not force then force = false end
for _, player in pairs( player.GetAll() ) do
if player:CheckGroup( "trial" ) then
if force then
DSR.SendToDiscord( ply, ply:Nick() .. " is asking for help from " .. DSR.ServerName .. " (" .. DSR.ServerIP .. "). Their message: " .. text .. " <@&245039887709896704>" )
return
else
ULib.tsayError( ply, "There is already an admin online: " .. player:Nick() )
ULib.tsayError( ply, "If the Admin is AFK, use !calladminforce to send the message anyways." )
return
end
end
end
if timer.Exists( "calladmin_delay" ) then
ULib.tsayError( ply, "Call Admin has already been used recently, try again in " .. tostring( ( last_call + DSR.CallAdminDelay ) - CurTime() ) .. " seconds." )
return
end
last_call = last_call or CurTime()
timer.Create( "calladmin_delay", DSR.CallAdminDelay, 1, function()
timer.Remove( "calladmin_delay" )
last_call = nil
end )
ulx.fancyLogAdmin( ply, "#A has called for an Admin!" )
DSR.ActiveCall = DSR.ActiveCall + 1
DSR.Active = true
DSR.SendToDiscord( ply, ply:Nick() .. " is asking for help from " .. DSR.ServerName .. " (" .. DSR.ServerIP .. "). Their message: \"" .. text .. "\". Case number: " .. tostring( DSR.ActiveCall ) .. " <@&245039887709896704>" )
end
local calladmin = ulx.command( "Utility", "ulx calladmin", DSR.CallAdmin, { "!calladmin", "!call" }, true, true )
calladmin:addParam{ type=ULib.cmds.StringArg, ULib.cmds.takeRestOfLine, hint="your message here" }
calladmin:defaultAccess( ULib.ACCESS_ALL )
calladmin:help( "If you need help and there are no admins online, use this command to notify one." )
function DSR.CallAdminForce( ply, text )
DSR.CallAdmin( ply, text, true )
end
local calladminforce = ulx.command( "Utility", "ulx calladminforce", DSR.CallAdminForce, { "!calladminforce", "!callforce" }, true, true )
calladminforce:addParam{ type=ULib.cmds.StringArg, ULib.cmds.takeRestOfLine, hint="your message here" }
calladminforce:defaultAccess( ULib.ACCESS_ALL )
calladminforce:help( "If you need help and there are no admins online, use this command to notify one." )
function DSR.HandleCall( ply )
if not DSR.Active then
ULib.tsayError( ply, "There is no current Admin call to handle!", true )
return
end
DSR.SendToDiscord( ply, "Most recent admin call was handled by " .. ply:Nick() .. " <@&245039887709896704>" )
DSR.Active = false
if timer.Exists( "calladmin_delay" ) then timer.Remove( "calladmin_delay" ) end
end
local handle = ulx.command( "Utility", "ulx handlecall", DSR.HandleCall, { "!handlecall", "!handle" }, true, true )
handle:defaultAccess( ULib.ACCESS_OPERATOR )
handle:help( "If you have come to handle an admin call, use this to let the other Admins know." )