Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RADIUS = 750
- local COOLDOWN = 5
- gameevent.Listen( "player_hurt" )
- hook.Add( "player_hurt", "ChatsoundReactions", function( data )
- local ply = Player( data.userid )
- if ply != LocalPlayer() then return end
- ChatsoundReactions.nextGlobal = CurTime() + 1
- end )
- hook.Add( 'ChatsoundsSoundInit', 'ChatsoundReactions', function( ply, snd, sound_data, meta )
- if ChatsoundReactions.nextGlobal > CurTime() then return end
- local reaction = ChatsoundReactions.list[meta.Key]
- if !reaction then return end
- if reaction.ignoreSelf and ply == LocalPlayer() then return end
- if reaction.nextCall and reaction.nextCall > CurTime() then return end
- if LocalPlayer():GetPos():Distance( ply:GetPos() ) > RADIUS then return end
- if reaction.nextCallPerUser then
- local nextTime = reaction.nextCallPerUser[ply]
- if nextTime and nextTime > CurTime() then return end
- else
- reaction.nextCallPerUser = {}
- end
- local reacted = reaction.callback( ply, snd, sound_data, meta )
- if reacted then
- if ChatsoundReactions.log then
- print( string.format( 'Player %s triggered "%s"', ply:Name(), meta.Key ) )
- end
- reaction.nextCall = CurTime() + reaction.cooldown
- if reaction.cooldownPerUser then
- reaction.nextCallPerUser[ply] = CurTime() + reaction.cooldownPerUser
- end
- end
- end )
- function copyModifier( modifier )
- return {
- Id = modifier.IsLegacy and string.sub( modifier.Name, 8 ) or modifier.Name,
- Value = modifier.Value,
- }
- end
- local funkysongStack = 0
- local mewgunSpinUp = 0
- local mewgunUntil = 0
- ChatsoundReactions = {
- nextGlobal = 0,
- -- allowSelfReacting = ChatsoundReactions and ChatsoundReactions.allowSelfReacting or false,
- log = ChatsoundReactions and ChatsoundReactions.log or true,
- list = {
- ['ah overseas sexy guys'] = {
- cooldown = 0.1,
- cooldownPerUser = 0,
- ignoreSelf = true,
- callback = function( ply, snd, sound_data, meta )
- local modifiersMap = {
- skip = 45,
- cutoff = 20,
- }
- for _, modifier in ipairs( meta.Modifiers ) do
- local copy = copyModifier( modifier )
- modifiersMap[copy.Id] = copy.Value
- end
- local modifiers = {}
- for k, v in pairs( modifiersMap ) do
- table.insert( modifiers, { Id = k, Value = v } )
- end
- timer.Simple( sound_data["Duration"], function()
- chatsounds.API.PlaySound( "ah overseas sexy guys", modifiers )
- LocalPlayer():ConCommand( "actx poke" )
- end )
- return true
- end,
- },
- ['america ya'] = {
- cooldown = 5,
- cooldownPerUser = 10,
- ignoreSelf = true,
- callback = function( ply, snd, sound_data, meta )
- local INTERVAL = 1.2
- local TIMES = 3
- local modifiers = { { Id = "select", Value = 1 } }
- for _, modifier in ipairs( meta.Modifiers ) do
- if !string.find( modifier.Name:lower(), 'select' ) then
- table.insert( modifiers, copyModifier( modifier ) )
- end
- end
- timer.Create( 'hallo', INTERVAL, TIMES, function()
- chatsounds.API.PlaySound( "hallo", modifiers )
- LocalPlayer():ConCommand( "actx wave" )
- end )
- return true
- end,
- },
- ['funkysong'] = {
- cooldown = 0.5,
- cooldownPerUser = 0.30,
- callback = function( ply, snd, sound_data, meta )
- if funkysongStack == 0 then
- cmd( 'pac_event funkysong 1' )
- end
- funkysongStack = funkysongStack + 1
- local duration = math.Clamp( sound_data["Duration"], 0.1, 50 )
- timer.Simple( duration, function()
- funkysongStack = funkysongStack - 1
- if funkysongStack == 0 then
- cmd( 'pac_event funkysong 0' )
- elseif funkysongStack < 0 then
- funkysongStack = 0
- end
- end)
- return true
- end,
- },
- ['the glue'] = {
- cooldown = 0.5,
- cooldownPerUser = 1,
- callback = function( ply, snd, sound_data, meta )
- LocalPlayer():ConCommand( "actx zombie" )
- return true
- end,
- },
- ['nipah'] = {
- cooldown = 1,
- cooldownPerUser = 30,
- ignoreSelf = true,
- callback = function( ply, snd, sound_data, meta )
- timer.Simple( sound_data.Duration, function()
- chatsounds.API.PlaySound( "nipah", {} )
- LocalPlayer():ConCommand( "actx zombie" )
- end )
- return true
- end,
- },
- ['nig'] = {
- cooldown = 30,
- ignoreSelf = true,
- callback = function( ply, snd, sound_data, meta )
- timer.Simple( sound_data.Duration, function()
- chatsounds.API.PlaySound( "ger", {} )
- LocalPlayer():ConCommand( "actx poke" )
- end )
- return true
- end,
- },
- ['minigun spinup'] = {
- cooldown = 0,
- callback = function( ply, snd, sound_data, meta )
- mewgunSpinUp = CurTime() + 5
- RunConsoleCommand( 'actx', 'forward' )
- end,
- },
- ['minigun fire'] = {
- cooldown = 0,
- callback = function( ply, snd, sound_data, meta )
- if mewgunSpinUp < CurTime() then return end
- mewgunUntil = CurTime() + 5
- end,
- },
- ['mew'] = {
- cooldown = 0,
- callback = function( ply, snd, sound_data, meta )
- if mewgunUntil < CurTime() then return end
- mewgunUntil = CurTime() + 5
- RunConsoleCommand( 'actx', 'poke' )
- end,
- },
- },
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement