-- Not Made by Zilloy local MaxPlayers = 6 local Players = 0 local Dif_Mode = false local Dif_Factor = 6 local Dif_Setting = 2 DEV = { ["[U:1:279717236]"] = true, --Zilloy } ents.GetAllRealPlayers = function() local players = {} for index, ply in pairs(ents.GetAllPlayers()) do if ply:IsRealPlayer() then table.insert( players, ply ) end end return players end local DifTimer = timer.Create( 5, function() if Dif_Mode then Players = #ents.GetAllRealPlayers() for _, player in pairs( ents.GetAllRealPlayers() ) do local frac = math.max( Dif_Factor / Players, 1 ) player:SetAttributeValue( "dmg penalty vs players", frac ) player:SetAttributeValue( "mult max health", frac ) player:SetAttributeValue( "engy building health bonus", frac ) player:SetAttributeValue( "heal rate bonus", frac ) player:SetAttributeValue( "collect currency on kill", 1 ) if DIFF_TABLE[Dif_Setting].bonusattr ~= nil then player:SetAttributeValue( DIFF_TABLE[Dif_Setting].bonusattr[1], DIFF_TABLE[Dif_Setting].bonusattr[2] ) end end end end, 0) function SetDif( dif, _, _ ) MaxPlayers = dif end function ToggleDifMode( _, _, _ ) if Dif_Mode == true then Dif_Mode = false else Dif_Mode = true end print( "Dif mode is now set to: ", Dif_Mode ) end function ToggleDifMode( _, _, _ ) if Dif_Mode == true then Dif_Mode = false else Dif_Mode = true end print( "Dif mode is now set to: ", Dif_Mode ) end DIFF_TABLE = { [0] = { name = "Easy", factor = 4 }, [1] = { name = "Normal", factor = 5 }, [2] = { name = "Advanced", factor = 6 }, [3] = { name = "Expert", factor = 6, bonusattr = {[1] = "ammo regen", [2] = 0.1} }, [4] = { name = "Master", factor = 8, bonusattr = {[1] = "ammo regen", [2] = 0.15} }, } COMMANDS_TABLE = { { name = "!Dif", type = "difscale" }, { name = "/Dif", type = "difscale" }, } function PlayerChat(event_table) local text = event_table.text local userid = event_table.userid local player = ents.GetPlayerByUserId(userid) if ( player ) and ( player:IsValid() ) and ( player ~= nil ) then -- pcall( OnPlayerChat, player, text ) for i,s in pairs(COMMANDS_TABLE) do if ( string.match(string.lower(text), string.lower(s.name)) ) then if s.type == "difscale" then if DEV[player.m_szNetworkIDString] then local texttable = {} for v in string.gmatch(tostring(text), "[^ ]+") do texttable[#texttable + 1] = v end local diftype = tonumber(texttable[2]) if DIFF_TABLE[diftype] == nil then diftype = 2 end if Dif_Mode == false or (Dif_Factor ~= DIFF_TABLE[diftype].factor and tonumber(texttable[2]) ~= nil) then util.PrintToChatAll("\x07ffa500 Diffculty Scale enabled using " .. DIFF_TABLE[diftype].name .. " settings.") Dif_Setting = diftype Dif_Factor = DIFF_TABLE[diftype].factor Dif_Mode = true else util.PrintToChatAll("\x07ffa500 Diffculty Scale disabled") Dif_Mode = false end end end end end end end AddEventCallback("player_say", PlayerChat)