Jump to content

Fixing some bugs


//_Dragon

Recommended Posts

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) 

Link to comment

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) 
Link to comment
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) 

Link to comment
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 ) 
  

Link to comment
Debugscript = AddEventHandler

Dude 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 ) 
  

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...