util.PrintToConsoleAll("SCRIPT RUNNING") AddEventCallback("player_say", function(eventTable) util.PrintToConsoleAll("EVENT CALLED") local cmd = string.format( 'HellOnEarth.ProcessChatMessage(%q, %d)', eventTable.text, eventTable.userid ) --ents.FindByName("bignet"):AcceptInput("runscriptcode", cmd, nil, nil) eventTable.text = "fuck me" return ACTION_STOP end) regularVotes = 0 ultraVotes = 0 VoteInitiated = false DifficultyMenu = { timeout = 0, title = "A vote has been started to elevate the difficulty to Ultra Nightmare", itemsPerPage = 2, flags = MENUFLAG_NO_SOUND, onSelect = function(player, index) if index == 1 and player.hasVoted ~= 1 then regularVotes = regularVotes + 1 player.hasVoted = 1 player:PlaySoundToSelf('ui/hint.wav') for _, x in pairs(ents.GetAllPlayers()) do x:AcceptInput("$DisplayTextChat", "[VOTE] ".. player.m_szNetname .. " has voted for: {green}NORMAL") end elseif index == 2 and player.hasVoted ~= 1 then ultraVotes = ultraVotes + 1 player.hasVoted = 1 player:PlaySoundToSelf('ui/hint.wav') for _, x in pairs(ents.GetAllPlayers()) do x:AcceptInput("$DisplayTextChat","[VOTE] ".. player.m_szNetname .. " has voted for: {red}ULTRA NIGHTMARE") end end end } ResultMenuNightmare = { timeout = 20, title = "CHOICE: ULTRA NIGHTMARE", flags = MENUFLAG_NO_SOUND, [1] = { text = "Enemy attacks are more frequent and deal maximum damage, enemie's move speed is at maximum" }, [2] = { text = 'no respawning, if the entire team is dies, you lose' }, [3] = {text='This mode significantly surpasses the standard difficulty. Proceed with caution'} } ResultMenu = { timeout = 5, title = "CHOICE: NORMAL", flags = MENUFLAG_NO_SOUND, [1] = { text = 'Normal difficulty has been selected' } } TieMenu = { timeout = 5, title = "CHOICE: NORMAL", flags = MENUFLAG_NO_SOUND, [1] = { text = 'Votes tied, defaulting to Normal difficulty' } } NoVoteMenu = { timeout = 5, title = "CHOICE: NORMAL", flags = MENUFLAG_NO_SOUND, [1] = {text='No vote, defaulting to Normal difficulty'} } function VoteForDifficulty() if VoteInitiated then for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:AcceptInput("$DisplayTextChat", "[VOTE] A vote is already in progress.") end end return end VoteInitiated = true for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:PlaySoundToSelf('ptx/cinematic/death_stinger_mp.wav') end end local timeLeft = 30 local voteTimer = timer.Create(0.22, function() DifficultyMenu[1] = {text = "Keep the difficulty set to Normal " .. regularVotes .. "/6"} DifficultyMenu[2] = {text = "Increase the difficulty to Ultra Nightmare " .. ultraVotes .. "/6"} for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:DisplayMenu(DifficultyMenu) end end end, 0) CountdownTimer = timer.Create(1, function() timeLeft = timeLeft - 1 for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:Print(4, "VOTE ENDS IN: " .. timeLeft .. "s") end end if timeLeft <= 0 then timer.Stop(CountdownTimer) return end end, 30) timer.Simple(10, function() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:PlaySoundToSelf('ptx/sfx/timer_countdown.wav') end end end) timer.Simple(20, function() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:PlaySoundToSelf('ptx/sfx/timer_countdown.wav') end end end) timer.Simple(30, function() timer.Stop(voteTimer) if ultraVotes > regularVotes and (ultraVotes + regularVotes) > 0 then ents.FindByName("bignet").AcceptInput("runscriptcode","HellOnEarth.ULTRA_NIGHTMARE_BUFF_ACTIVE = true",nil,nil) for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:DisplayMenu(ResultMenuNightmare) player:PlaySoundToSelf('ptx/sfx/ultra_nightmare_select.wav') end end elseif regularVotes > ultraVotes then -- MORE LOGIC FOR: execute regular difficulty branch for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:DisplayMenu(ResultMenu) player:PlaySoundToSelf('ptx/sfx/normal_select.wav') end end elseif ultraVotes == regularVotes and (ultraVotes + regularVotes) > 0 then for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:DisplayMenu(TieMenu) player:PlaySoundToSelf('ptx/sfx/normal_select.wav') end end else for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:DisplayMenu(NoVoteMenu) player:PlaySoundToSelf('ptx/sfx/normal_select.wav') end end end timer.Simple(5, function() VoteInitiated = false regularVotes = 0 ultraVotes = 0 for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player.hasVoted = 0 end end end) end) end