//_Dragon Posted December 22, 2015 Posted December 22, 2015 I want add here , when player is shooting anythen ( vehicle , other player ...) it play sound addEventHandler("onClientPlayerDamage", root, function(attacker, weapon, bodypart) if attacker and attacker == localPlayer and source ~= attacker then playSound("hitmarker-sound.wav") end end)
Rockyz Posted December 23, 2015 Posted December 23, 2015 Server : addEventHandler('onPlayerDamage', root, function (attacker) if (attacker and attacker ~= source and getElementType (attacker) == 'player') then triggerClientEvent (source, 'PlayerSOUND', source) end end) Client : addEvent ('PlayerSOUND', true) addEventHandler ('PlayerSOUND', root, function () playSound ('hitmarker-sound.wav') end)
//_Dragon Posted December 23, 2015 Author Posted December 23, 2015 Not working , not working geting dmg sound | when i shoot i didn't listen dmg's sound Anyone ?
//_Dragon Posted December 23, 2015 Author Posted December 23, 2015 I want add here , when player is shooting anythen ( vehicle , other player ...) it play sound i make this script but i didn't listen when i shoot other player or vehicle addEventHandler("onClientPlayerDamage", root, function(attacker, weapon, bodypart) if attacker and attacker == localPlayer and source ~= attacker then playSound("hitmarker-sound.wav") end end)
dk99 Posted December 24, 2015 Posted December 24, 2015 - Try opening .wav file to see if it actually works. - Make sure you have added it in meta.xml or simply post your meta.xml here - What about /debugscript 3 ?
Noki Posted December 24, 2015 Posted December 24, 2015 If you want the sound to play when the local player shoots, use onClientPlayerWeaponFire.
//_Dragon Posted December 24, 2015 Author Posted December 24, 2015 If you want the sound to play when the local player shoots, use onClientPlayerWeaponFire. Can u do it ? idont think this will fixe it
dk99 Posted December 24, 2015 Posted December 24, 2015 If you want the sound to play when the local player shoots, use onClientPlayerWeaponFire. Can u do it ? idont think this will fixe it It will. onClientPlayerWeaponFire will trigger each time you fire your gun. onClientPlayerDamage will only trigger if you damage a player element not other object elements. addEventHandler("onClientPlayerWeaponFire", source, function () playSound("hitmarker-sound.wav") end )
//_Dragon Posted December 24, 2015 Author Posted December 24, 2015 i need to active sound when i damage other object elements ( vehicles .. )
dk99 Posted December 24, 2015 Posted December 24, 2015 i need to active sound when i damage other object elements ( vehicles .. ) Test the code, I gave you.
//_Dragon Posted December 24, 2015 Author Posted December 24, 2015 Debugscript = AddEventHandler Dude i want make sound in shoting object too !!
dk99 Posted December 24, 2015 Posted December 24, 2015 Debugscript = AddEventHandlerDude i want make sound in shoting object too !! Oops, I made a typo accidently. I was on phone. addEventHandler("onClientPlayerWeaponFire", localPlayer, -- It should be localPlayer instead of source function () playSound("hitmarker-sound.wav") end )
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now