Author Topic: Killstreak sounds?  (Read 1619 times)

0 Members and 1 Guest are viewing this topic.

Offline ErraticFox

  • Newbie
  • *
  • Posts: 10
  • Karma: 0
Killstreak sounds?
« on: January 22, 2014, 11:25:34 PM »
Could someone help me in making a simple sandbox killstreak sound? Or tell me how I'd go about doing this? I have my sound files.

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: Killstreak sounds?
« Reply #1 on: January 23, 2014, 11:02:43 AM »
You would want to look at these pages...

http://wiki.garrysmod.com/page/ENTITY/OnTakeDamage -- For running things when a player takes damage. (SHARED, works on both the client and server.)
http://wiki.garrysmod.com/page/Player/Alive -- For checking if a player is alive. (SHARED, works on both the client and server.)
http://wiki.garrysmod.com/page/Player/Frags -- Check how many kills a person has. (SHARED, works on both the client and server.)
http://wiki.garrysmod.com/page/Player/Deaths -- Check how many deaths a person has. (SHARED, works on both the client and server.)
http://wiki.garrysmod.com/page/surface/PlaySound -- Plays a sound of your choice. (CLIENT, works only on the client.)


Some example code to help you get started.

Code: [Select]
hook.Add("EntityTakeDamage", "YoureSpecialNameOfChoice", function( target, dmginfo )
if ( target:IsPlayer() ) then
if (target:Health() - dmginfo:GetDamage()) or not target:Alive() then
print( target:Nick() .. " has just been killed!" )
end
end
end)

If you killed me in game, the above code would write "LuaTenshi has just been killed!" in the servers console.
« Last Edit: January 25, 2014, 09:10:25 PM by LuaTenshi »
I cry every time I see that I am not a respected member of this community.