Advertisement
Guest User

Dominating Hitsound LUA

a guest
Aug 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.74 KB | None | 0 0
  1. callbacks = variables.Callbacks
  2. engine = variables.Interfaces:Engine()
  3.  
  4. sound = "music\\dominating"
  5. name = "dominating"
  6.  
  7. gui = variables.gui
  8. gui:AddOption("hitsound", name)
  9.  
  10. function onevent()
  11.     if variables.event:GetName() == "player_hurt" then --someone hurt someone else
  12.         attacker = engine:PlayerForUserID(variables.event:GetInt("attacker"))
  13.         if attacker == engine:LocalPlayer() then --localplayer hurt someone else
  14.             if gui:SelectedOption("hitsound", name) then --our custom hitsound is enabled
  15.                 engine:ExecuteCommand("playvol " .. sound .. " " .. gui:GetValue("hitsound_volume") * .01) --play our defined sound using the volume from the slider in the ui
  16.             end
  17.         end
  18.     end
  19. end
  20.  
  21. callbacks:Register(variables.GAMEEVENT, "onevent")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement