0 Members and 1 Guest are viewing this topic.
-- add all usergroups here with cooldown timeslocal groups = {}groups.admin = 10groups.superadmin = 5groups.owner = 3-- groups who shouldnt be affected by a cooldownlocal blacklist = { "owner", "superadmin" }timer.Simple( 10, function() hook.Add( "ULibCommandCalled", "CheckCommands", function( ply, cmd, args ) if table.HasValue( blacklist, ply:GetUserGroup() ) then return end if not ply.cooldown or ply.cooldown <= 0 then ply.cooldown = groups[ ply:GetUserGroup() ] else ply:ChatPrint( "Please wait " .. tostring( ply.cooldown ) .. " more seconds before you use a command again." ) return false end end )end )timer.Create( "Cooldown", 1, 0, function() for k, v in next, player.GetAll() do if v.cooldown then if v.cooldown > 0 then v.cooldown = v.cooldown - 1 if v.cooldown == 0 then v.cooldown = nil end elseif v.cooldown <= 0 then v.cooldown = nil end end endend )