Advertisement
Aoki1337

Untitled

Jan 12th, 2025 (edited)
70
0
5 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.05 KB | None | 0 0
  1. local RADIUS = 750
  2. local COOLDOWN = 5
  3.  
  4. gameevent.Listen( "player_hurt" )
  5.  
  6. hook.Add( "player_hurt", "ChatsoundReactions", function( data )
  7.     local ply = Player( data.userid )
  8.     if ply != LocalPlayer() then return end
  9.  
  10.     ChatsoundReactions.nextGlobal = CurTime() + 1
  11. end )
  12.  
  13. hook.Add( 'ChatsoundsSoundInit', 'ChatsoundReactions', function( ply, snd, sound_data, meta )
  14.     if ChatsoundReactions.nextGlobal > CurTime() then return end
  15.  
  16.     local reaction = ChatsoundReactions.list[meta.Key]
  17.     if !reaction then return end
  18.     if reaction.ignoreSelf and ply == LocalPlayer() then return end
  19.     if reaction.nextCall and reaction.nextCall > CurTime() then return end
  20.  
  21.     if LocalPlayer():GetPos():Distance( ply:GetPos() ) > RADIUS then return end
  22.  
  23.     if reaction.nextCallPerUser then
  24.         local nextTime = reaction.nextCallPerUser[ply]
  25.  
  26.         if nextTime and nextTime > CurTime() then return end
  27.     else
  28.         reaction.nextCallPerUser = {}
  29.     end
  30.  
  31.     local reacted = reaction.callback( ply, snd, sound_data, meta )
  32.  
  33.     if reacted then
  34.         if ChatsoundReactions.log then
  35.             print( string.format( 'Player %s triggered "%s"', ply:Name(), meta.Key ) )
  36.         end
  37.  
  38.         reaction.nextCall = CurTime() + reaction.cooldown
  39.  
  40.         if reaction.cooldownPerUser then
  41.             reaction.nextCallPerUser[ply] = CurTime() + reaction.cooldownPerUser
  42.         end
  43.     end
  44. end )
  45.  
  46. function copyModifier( modifier )
  47.     return {
  48.         Id = modifier.IsLegacy and string.sub( modifier.Name, 8 ) or modifier.Name,
  49.         Value = modifier.Value,
  50.     }
  51. end
  52.  
  53. local funkysongStack = 0
  54. local mewgunSpinUp = 0
  55. local mewgunUntil = 0
  56.  
  57. ChatsoundReactions = {
  58.     nextGlobal = 0,
  59.     -- allowSelfReacting = ChatsoundReactions and ChatsoundReactions.allowSelfReacting or false,
  60.     log = ChatsoundReactions and ChatsoundReactions.log or true,
  61.     list = {
  62.         ['ah overseas sexy guys'] = {
  63.             cooldown = 0.1,
  64.             cooldownPerUser = 0,
  65.             ignoreSelf = true,
  66.             callback = function( ply, snd, sound_data, meta )
  67.                 local modifiersMap = {
  68.                     skip = 45,
  69.                     cutoff = 20,
  70.                 }
  71.  
  72.                 for _, modifier in ipairs( meta.Modifiers ) do
  73.                     local copy = copyModifier( modifier )
  74.                     modifiersMap[copy.Id] = copy.Value
  75.                 end
  76.  
  77.                 local modifiers = {}
  78.  
  79.                 for k, v in pairs( modifiersMap ) do
  80.                     table.insert( modifiers, { Id = k, Value = v } )
  81.                 end
  82.  
  83.                 timer.Simple( sound_data["Duration"], function()
  84.                     chatsounds.API.PlaySound( "ah overseas sexy guys", modifiers )
  85.                     LocalPlayer():ConCommand( "actx poke" )
  86.                 end )
  87.  
  88.                 return true
  89.             end,
  90.         },
  91.         ['america ya'] = {
  92.             cooldown = 5,
  93.             cooldownPerUser = 10,
  94.             ignoreSelf = true,
  95.             callback = function( ply, snd, sound_data, meta )
  96.                 local INTERVAL = 1.2
  97.                 local TIMES = 3
  98.                 local modifiers = { { Id = "select", Value = 1 } }
  99.  
  100.                 for _, modifier in ipairs( meta.Modifiers ) do
  101.                     if !string.find( modifier.Name:lower(), 'select' ) then
  102.                         table.insert( modifiers, copyModifier( modifier ) )
  103.                     end
  104.                 end
  105.  
  106.                 timer.Create( 'hallo', INTERVAL, TIMES, function()
  107.                     chatsounds.API.PlaySound( "hallo", modifiers )
  108.                     LocalPlayer():ConCommand( "actx wave" )
  109.                 end )
  110.  
  111.                 return true
  112.             end,
  113.         },
  114.         ['funkysong'] = {
  115.             cooldown = 0.5,
  116.             cooldownPerUser = 0.30,
  117.             callback = function( ply, snd, sound_data, meta )
  118.                 if funkysongStack == 0 then
  119.                     cmd( 'pac_event funkysong 1' )
  120.                 end
  121.  
  122.                 funkysongStack = funkysongStack + 1
  123.                 local duration = math.Clamp( sound_data["Duration"], 0.1, 50 )
  124.  
  125.                 timer.Simple( duration, function()
  126.                     funkysongStack = funkysongStack - 1
  127.  
  128.                     if funkysongStack == 0 then
  129.                         cmd( 'pac_event funkysong 0' )
  130.                     elseif funkysongStack < 0 then
  131.                         funkysongStack = 0
  132.                     end
  133.                 end)
  134.  
  135.                 return true
  136.             end,
  137.         },
  138.         ['the glue'] = {
  139.             cooldown = 0.5,
  140.             cooldownPerUser = 1,
  141.             callback = function( ply, snd, sound_data, meta )
  142.                 LocalPlayer():ConCommand( "actx zombie" )
  143.                 return true
  144.             end,
  145.         },
  146.         ['nipah'] = {
  147.             cooldown = 1,
  148.             cooldownPerUser = 30,
  149.             ignoreSelf = true,
  150.             callback = function( ply, snd, sound_data, meta )
  151.                 timer.Simple( sound_data.Duration, function()
  152.                     chatsounds.API.PlaySound( "nipah", {} )
  153.                     LocalPlayer():ConCommand( "actx zombie" )
  154.                 end )
  155.  
  156.                 return true
  157.             end,
  158.         },
  159.         ['nig'] = {
  160.             cooldown = 30,
  161.             ignoreSelf = true,
  162.             callback = function( ply, snd, sound_data, meta )
  163.                 timer.Simple( sound_data.Duration, function()
  164.                     chatsounds.API.PlaySound( "ger", {} )
  165.                     LocalPlayer():ConCommand( "actx poke" )
  166.                 end )
  167.  
  168.                 return true
  169.             end,
  170.         },
  171.         ['minigun spinup'] = {
  172.             cooldown = 0,
  173.             callback = function( ply, snd, sound_data, meta )
  174.                 mewgunSpinUp = CurTime() + 5
  175.                 RunConsoleCommand( 'actx', 'forward' )
  176.             end,
  177.         },
  178.         ['minigun fire'] = {
  179.             cooldown = 0,
  180.             callback = function( ply, snd, sound_data, meta )
  181.                 if mewgunSpinUp < CurTime() then return end
  182.                 mewgunUntil = CurTime() + 5
  183.             end,
  184.         },
  185.         ['mew'] = {
  186.             cooldown = 0,
  187.             callback = function( ply, snd, sound_data, meta )
  188.                 if mewgunUntil < CurTime() then return end
  189.                 mewgunUntil = CurTime() + 5
  190.  
  191.                 RunConsoleCommand( 'actx', 'poke' )
  192.             end,
  193.         },
  194.     },
  195. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement