• Sound OnTakeDamage
    4 replies, posted
Hi, i try to put this ... [CODE] local function OnTakeDamage(damage) if ply:OnTakeDamage(IsBulletDamage) then if(ply:IsPlayer() and ply:Team() == TEAM_PC_RECRUE or ply:Team() == TEAM_PC or ply:Team() == TEAM_PC_MEDIC or ply:Team() == TEAM_PC_ELITE or ply:Team() == TEAM_PC_INTERVENTION or ply:Team() == TEAM_PC_OFC ) then ply:EmitSound("npc/metropolice/pain"..math.random(1,4)..".wav") end end end hook.Add("OnTakeDamage","MiliceDamage", OnTakeDamage) [/CODE] ...In my gamemode to make a sound when the Team is damaged but that makes nothing. Please help me :/
I would probably use this hook: [url]http://wiki.garrysmod.com/page/GM/EntityTakeDamage[/url]
Thank you ! [editline]30th November 2014[/editline] re : I put this : [CODE]function EntityTakeDamage( target, dmginfo ) if ((target:IsPlayer() and dmginfo:IsBulletDamage())and ply:Team() == TEAM_PC_RECRUE or ply:Team() == TEAM_PC or ply:Team() == TEAM_PC_MEDIC or ply:Team() == TEAM_PC_ELITE or ply:Team() == TEAM_PC_INTERVENTION or ply:Team() == TEAM_PC_OFC ) then ply:EmitSound("npc/metropolice/pain"..math.random(1,4)..".wav") end return dmginfo end hook.Add("EntityTakeDamage","MilicePain",EntityTakeDamage)[/CODE] and nothing again :/ [editline]30th November 2014[/editline] Oh, I put it in "autorun/lua/client" is it another folder ? [editline]30th November 2014[/editline] Oh, I put it in "lua/autorun/client" is it another folder ?
It goes in lua/autorun/server
Oh, ok [editline]30th November 2014[/editline] Thank you, it work. Now, I don't know how, but I would like to make the sound activate his self only 1/2 bullet. Can you help me ? [editline]30th November 2014[/editline] i find how, thank you all :)
Sorry, you need to Log In to post a reply to this thread.