Jump to content

error sound


manawydan

Recommended Posts

function jedi(weaponID) 
  local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition(source) 
    local px, py, pz = getElementPosition ( source ) 
  
       if weaponID == 8 then  
            local sound = playSound3D("jedi.mp3", muzzleX, muzzleY, muzzleZ, false) 
            setSoundMaxDistance(sound, 40) 
                end 
end 
addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), jedi ) 

what went wrong?

Link to comment
function jedi(weaponID, Player) 
  local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition(Player) 
    local px, py, pz = getElementPosition ( Player ) 
  
       if weaponID == 8 and isControlEnabled ( player, "fire" ) then  
            local sound = playSound3D("jedi.mp3", muzzleX, muzzleY, muzzleZ, false) 
            setSoundMaxDistance(sound, 40) 
                end 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), jedi ) 

this right? never used isControlEnabled

Link to comment

I said onClientKey, not onClientResourceStart.

Try this:

function jedi ( ) 
    local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition ( localPlayer ) 
    local px, py, pz = getElementPosition ( localPlayer ) 
    local weaponID = getPedWeapon ( localPlayer ) 
    if ( weaponID == 8 and isControlEnabled ( "fire" ) ) then 
        local sound = playSound3D ( "jedi.mp3", muzzleX, muzzleY, muzzleZ, false ) 
        setSoundMaxDistance ( sound, 40 ) 
    end 
end 
bindKey ( "fire", "down", jedi ) 

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...